{"record":{"id":"560dc5608543fd45","repo":"gastownhall/beads","slug":"failed-to-update-s-during-reimport-v","errorCode":null,"errorMessage":"Failed to update %s during reimport: %v","messagePattern":"Failed to update (.+?) during reimport: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/tracker/engine.go","lineNumber":1309,"sourceCode":"\t\treturn\n\t}\n\n\tupdates := map[string]interface{}{\n\t\t\"title\":       conv.Issue.Title,\n\t\t\"description\": conv.Issue.Description,\n\t\t\"priority\":    conv.Issue.Priority,\n\t\t\"status\":      string(conv.Issue.Status),\n\t}\n\tif extIssue.Metadata != nil {\n\t\tif raw, err := json.Marshal(extIssue.Metadata); err == nil {\n\t\t\tupdates[\"metadata\"] = json.RawMessage(raw)\n\t\t}\n\t}\n\n\tif err := e.Store.RunInIssueLifecycleTransaction(ctx, fmt.Sprintf(\"bd: reimport update %s\", c.IssueID), func(tx storage.IssueLifecycleTransaction) error {\n\t\treturn applyPullIssueFields(ctx, tx, c.IssueID, updates, e.Actor)\n\t}); err != nil {\n\t\te.warn(\"Failed to update %s during reimport: %v\", c.IssueID, err)\n\t}\n}\n\n// createDependencies creates dependencies from the pending list, matching\n// external IDs to local issue IDs. Returns the number of dependencies that\n// failed to resolve or create.\nfunc (e *Engine) createDependencies(ctx context.Context, deps []DependencyInfo) int {\n\tif len(deps) == 0 {\n\t\treturn 0\n\t}\n\n\tresolveIssue, err := e.dependencyIssueResolver(ctx, nil)\n\tif err != nil {\n\t\te.warn(\"Failed to build dependency resolver: %v\", err)\n\t\treturn len(deps)\n\t}\n\n\terrCount := 0","sourceCodeStart":1291,"sourceCodeEnd":1327,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/tracker/engine.go#L1291-L1327","documentation":"The external version was fetched and mapped successfully, but applying the scalar field updates (title, description, priority, status, metadata) to the local issue inside a lifecycle transaction failed. The local issue keeps its pre-reimport values despite conflict resolution choosing the external side.","triggerScenarios":"e.Store.RunInIssueLifecycleTransaction(...applyPullIssueFields...) returns an error when reimporting a conflict — transaction begin/commit failure, storage lock, validation rejection of field values (e.g. invalid status), or the local issue having been deleted mid-sync.","commonSituations":"Local DB locked by another bd process; status value from the tracker doesn't map to a valid local status enum; issue deleted concurrently; disk-full during transaction commit.","solutions":["Check the storage error text (lock, constraint, validation) and fix accordingly.","If the status is rejected, verify the tracker's field mapper maps remote states to valid bd statuses.","Re-run `bd sync` to retry the reimport once storage is healthy.","Ensure no other bd process holds the write lock during sync.","If the issue was deleted locally, drop the conflict expectation and recreate/delete as needed."],"exampleFix":"// before: invalid status from remote mapping causes tx failure\n// after: align the mapper's status mapping with bd's allowed statuses\n// e.g. map \"In Progress\" -> \"in_progress\" instead of \"wip\"","handlingStrategy":"validation","validationCode":"// ensure mapped remote statuses are valid bd statuses before pulling conflicts\nvalid := map[string]bool{\"open\": true, \"in_progress\": true, \"closed\": true}\nif !valid[strings.ToLower(extStatus)] {\n    log.Printf(\"remote status %q unmapped — update the field mapper\", extStatus)\n}","typeGuard":null,"tryCatchPattern":"// storage errors during reimport: wait, then re-run sync (idempotent)\nstats, err := engine.Sync(ctx, opts)\nif stats != nil && stats.Errors > 0 && isStorageErr(err) {\n    time.Sleep(2 * time.Second)\n    engine.Sync(ctx, opts)\n}","preventionTips":["Single writer per repo — serialize bd processes","Validate tracker→bd status mappings when configuring an adapter","Free disk space and check locks when tx failures cluster","Verify local fields updated after external-wins conflict resolution"],"tags":["sync","conflict","storage","transaction"],"backgroundTag":"local-write-transaction-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}