{"record":{"id":"f5738a7cb368ae13","repo":"gastownhall/beads","slug":"failed-to-update-s-v","errorCode":null,"errorMessage":"Failed to update %s: %v","messagePattern":"Failed to update (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tracker/engine.go","lineNumber":534,"sourceCode":"\t\t\t\te.msg(\"[dry-run] Would update local issue: %s - %s\", extIssue.Identifier, ui.SanitizeForTerminal(extIssue.Title))\n\t\t\t\tstats.Updated++\n\t\t\t} else {\n\t\t\t\te.msg(\"[dry-run] Would import: %s - %s\", extIssue.Identifier, ui.SanitizeForTerminal(extIssue.Title))\n\t\t\t\tstats.Created++\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif existing != nil {\n\t\t\tupdates := buildPullIssueUpdates(existing, conv.Issue, ref)\n\t\t\tif raw, ok := marshalTrackerMetadata(extIssue.Metadata); ok {\n\t\t\t\tupdates[\"metadata\"] = raw\n\t\t\t}\n\n\t\t\tif err := e.Store.RunInIssueLifecycleTransaction(ctx, fmt.Sprintf(\"bd: pull update %s\", existing.ID), func(tx storage.IssueLifecycleTransaction) error {\n\t\t\t\treturn applyPullIssueUpdate(ctx, tx, existing.ID, updates, conv.Issue.Labels, e.Actor)\n\t\t\t}); err != nil {\n\t\t\t\te.warn(\"Failed to update %s: %v\", existing.ID, err)\n\t\t\t\tstats.Errors++\n\t\t\t\tif pulledIDs != nil {\n\t\t\t\t\tpulledIDs[existing.ID] = true\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstats.Updated++\n\t\t\tif pulledIDs != nil {\n\t\t\t\tpulledIDs[existing.ID] = true\n\t\t\t}\n\t\t} else {\n\t\t\t// Create new issue\n\t\t\tconv.Issue.ExternalRef = strPtr(ref)\n\t\t\tif raw, ok := marshalTrackerMetadata(extIssue.Metadata); ok {\n\t\t\t\tconv.Issue.Metadata = raw\n\t\t\t}\n\t\t\tif err := e.Store.CreateIssue(ctx, conv.Issue, e.Actor); err != nil {\n\t\t\t\te.warn(\"Failed to create issue for %s: %v\", extIssue.Identifier, err)","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/tracker/engine.go#L516-L552","documentation":"In doPull (internal/tracker/engine.go:534), when pulling an issue that already exists locally, beads wraps the update in a storage transaction (RunInIssueLifecycleTransaction -> applyPullIssueUpdate) applying field updates and labels. If the transaction fails, the engine warns with the local issue ID, increments stats.Errors, and continues with the next issue. The sync is not aborted; the failed issue simply is not updated.","triggerScenarios":"Running a pull/sync where a remote issue maps to an existing local issue and the storage update fails — DB locked or closed, constraint violation (e.g. invalid status/type value, unparseable metadata JSON from the tracker), uniqueness conflict on external_ref or ID, or the lifecycle transaction rejects a field transition.","commonSituations":"Concurrent `bd` processes contending for the same database (lock timeouts); tracker metadata containing values that violate local storage constraints; schema mismatch after a beads version upgrade without migration; disk-full or corrupted Dolt/sqlite state.","solutions":["Read the `%v` detail to identify the failing constraint (lock, uniqueness, invalid field, schema).","Ensure no other bd process holds the DB; retry the pull after concurrent commands finish.","Fix the offending remote/local data (e.g. invalid status or metadata the local schema cannot accept).","Run pending migrations / `bd doctor` if the schema may be out of date after an upgrade.","Re-run the pull; issues whose updates failed are retried since they were not synced successfully."],"exampleFix":"// before: concurrent process holds a write lock\nFailed to update bd-123: database is locked (5) (SQLITE_BUSY)\n// after: finish/close the concurrent bd process, then\nbd sync  # update succeeds, stats.Updated incremented for bd-123","handlingStrategy":"retry","validationCode":"// before running sync, ensure no other bd process holds the DB and it is writable:\nbd doctor   # or: check no concurrent `bd` runs; test write access to the .beads database","typeGuard":null,"tryCatchPattern":"// doPull continues past the failure; verify via returned stats and re-run:\nstats, err := eng.Sync(ctx, opts)\nif err != nil { log.Fatalf(\"sync: %v\", err) }\nif stats.Errors > 0 {\n    time.Sleep(2 * time.Second)\n    if _, err := eng.Sync(ctx, opts); err != nil { log.Printf(\"retry sync failed: %v\", err) }\n}","preventionTips":["Avoid running multiple bd commands concurrently on the same repository.","Keep the beads storage schema migrated after upgrades (`bd migrate`/`bd doctor`).","Monitor disk space on the machine hosting the database.","Re-run sync whenever stats.Errors > 0."],"tags":["storage","transaction","sync","database"],"backgroundTag":"storage-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}