{"record":{"id":"c9b0fbd126067558","repo":"benbjohnson/litestream","slug":"wait-for-db-sync-executor-w","errorCode":null,"errorMessage":"wait for db sync executor: %w","messagePattern":"wait for db sync executor: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"db.go","lineNumber":1255,"sourceCode":"\nfunc (db *DB) syncOnce(ctx context.Context, maxSyncWALBytes int64) (syncResult, error) {\n\tif err := db.lockExec(ctx); err != nil {\n\t\treturn syncResult{}, err\n\t}\n\tdefer db.execSem.Release(1)\n\n\treturn db.syncLocked(ctx, maxSyncWALBytes)\n}\n\nfunc (db *DB) lockExec(ctx context.Context) error {\n\tif db.execSem.TryAcquire(1) {\n\t\treturn nil\n\t}\n\tdb.beginSyncExecutorWait()\n\tdefer db.finishSyncExecutorWait()\n\n\tif err := db.execSem.Acquire(ctx, 1); err != nil {\n\t\treturn fmt.Errorf(\"wait for db sync executor: %w\", context.Cause(ctx))\n\t}\n\treturn nil\n}\n\nfunc (db *DB) syncLocked(ctx context.Context, maxSyncWALBytes int64) (result syncResult, err error) {\n\tdb.beginSyncDiag(diagOpSync)\n\tdefer func() { db.finishSyncDiag(err) }()\n\n\t// Track total sync metrics.\n\tt := time.Now()\n\tdefer func() {\n\t\tdb.syncNCounter.Inc()\n\t\tif err != nil {\n\t\t\tdb.syncErrorNCounter.Inc()\n\t\t}\n\t\tif isDiskFullError(err) {\n\t\t\tdb.diskFullGauge.Set(1)\n\t\t} else {","sourceCodeStart":1237,"sourceCodeEnd":1273,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/db.go#L1237-L1273","documentation":"lockExec's semaphore Acquire failed while waiting for the running sync executor to finish. The context was cancelled or timed out before the exclusive sync slot became free — e.g. shutdown during an in-flight sync.","triggerScenarios":"Thrown at db.go:1255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Let the in-flight sync complete before shutting down","Check whether the current sync is stuck (inspect sync diagnostics/metrics)","Increase timeouts if syncs are routinely longer than the wait budget"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}