<@U04S8PLJWMT> airbyte wehbook for failed sync get...
# ask-ai
p
@kapa.ai airbyte wehbook for failed sync gets send before even sync goes into failed state, is that correct?
k
Based on the available documentation, Airbyte sends webhook notifications for failed syncs after the sync attempt has finished and the failure has been detected. The webhook payload for a failed sync includes fields such as
finishedAt
,
success: false
, and an
errorMessage
, which indicates that the sync has already completed and its status has been determined before the notification is sent. There is no indication in the documentation that the webhook is triggered before the sync actually enters the failed state. The notification is meant to inform you of the result after the job has finished processing and failed, not before or during the failure process. Here is an example of the failed sync webhook payload, which includes the
finishedAt
timestamp and the
success: false
flag:
Copy code
json {       "data": {           "workspace": { ... },           "connection":{ ... },           "source":{ ... },           "destination":{ ... },           "jobId":9988,           "startedAt":"2024-01-01T00:00:00Z",           "finishedAt":"2024-01-01T01:00:00Z",           "bytesEmitted":1000,           "bytesCommitted":90,           "recordsEmitted":89,           "recordsCommitted":45,           "errorMessage":"Something failed",           "errorType": "config_error",           "errorOrigin": "source",           "success":false,           "durationInSeconds":3600,           "durationFormatted":"1 hours 0 min"       }   }
This structure confirms that the notification is sent after the sync has failed, not before it is marked as failed in Airbyte's state machine. If you are experiencing different behavior, it may be a bug or an edge case not covered in the documentation. But according to the official docs, the webhook is sent after the sync is in the failed state [Configure Webhook Notification Settings](https://docs.airbyte.com/platform/1.7/cloud/managing-airbyte-cloud/manage-airbyte-cloud-notifications#configure-webhook-notification-settings).
p
@kapa.ai even if there is no sync running when api called to initiate sync getting already sync running
k
A message from kapa.ai
If you are receiving an error like “A sync is already running for: [connection_id]” when calling the API to initiate a sync, even though there is no sync visibly running, this is a known issue that has been reported by several users. This situation can occur if a previous sync job is stuck in a "running" or "in-progress" state, even though it is not actively moving data or has already completed. This can prevent new syncs from being triggered for that connection. Some possible causes and scenarios from the knowledge sources: - Stuck or Hanging Jobs: Sometimes, sync jobs can get stuck in a running state due to resource constraints, Kubernetes pod scheduling issues, or internal errors. This leaves the job marked as "running" in the Airbyte state, blocking new syncs from starting. Users have reported that even after a sync appears to have finished, the system still thinks a sync is running, resulting in this error when trying to start a new one [Syncs getting stuck on](https://discuss.airbyte.io/t/2394), [Sync 2nd time fails even after download succeeded](https://discuss.airbyte.io/t/3486), [When click "sync now" the connection got stuck throwing error](https://discuss.airbyte.io/t/3336). - Job State Not Cleared Properly: There are cases where, after a reset or a failed/canceled sync, the job state is not properly cleared, and Airbyte continues to block new syncs for that connection, even though nothing is running. This has been observed after resets and failed jobs [Connection Sync Issues Following Data Reset](https://github.com/airbytehq/airbyte/issues/47523). - Autorecovery Improvements: Newer versions of Airbyte have introduced a heartbeat service to detect and recover from hanging connections, automatically creating a new job attempt if a sync is stuck in a perpetual "in-progress" state [Release Notes v1.4](https://docs.airbyte.com/release_notes/v-1.4#-bug-fixes). If you are on an older version, you may not have this feature. What you can do: - Check the Airbyte UI or API for any jobs in a "running" or "in-progress" state for the connection. - If possible, cancel the stuck job from the UI or API. - If the job cannot be canceled, restarting the Airbyte worker or relevant pods may clear the state. - Upgrading to a newer version of Airbyte may help, as recent releases have improved handling of stuck jobs. If the issue persists after these steps, it may be a bug or require manual intervention in the Airbyte database, which should be done with caution. Summary: Yes, it is possible to get the "already sync running" error even when no sync appears to be running, due to stuck or uncleared job states. This is a known issue, especially in older Airbyte versions, and has been addressed in more recent releases with improved job state management and autorecovery features.