{"record":{"id":"8b3320f0fb73e208","repo":"gastownhall/beads","slug":"resolving-id-s-w","errorCode":null,"errorMessage":"resolving ID %s: %w","messagePattern":"resolving ID (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/close.go","lineNumber":738,"sourceCode":"\t\tsharedRoutedTried = true\n\t\trs, routed, _, err := openRoutedReadStore(ctx, localStore)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif !routed {\n\t\t\treturn nil, fmt.Errorf(\"no auto-routed store available\")\n\t\t}\n\t\tsharedRouted = rs\n\t\treturn rs, nil\n\t}\n\tfor _, id := range ids {\n\t\t// Local first.\n\t\tif r, err := resolveAndGetFromStore(ctx, localStore, id, false); err == nil {\n\t\t\tresults = append(results, r)\n\t\t\tcontinue\n\t\t} else if !isNotFoundErr(err) {\n\t\t\tcleanup()\n\t\t\treturn nil, func() {}, fmt.Errorf(\"resolving ID %s: %w\", id, err)\n\t\t}\n\t\t// Write-intent: a prefix-routed target opens writable so the close\n\t\t// commits on the target head (#4141). Contributor auto-routing below\n\t\t// stays read-only: it hydrates foreign projects that must not be mutated.\n\t\tif r, err := resolveViaPrefixRoutingWithAccess(ctx, id, true); err == nil {\n\t\t\tresults = append(results, r)\n\t\t\tcontinue\n\t\t}\n\t\t// Contributor auto-routing uses one shared store for the whole batch.\n\t\tif rs, rerr := ensureShared(); rerr == nil {\n\t\t\tif r, err := resolveAndGetFromStore(ctx, rs, id, true); err == nil {\n\t\t\t\t// Per-id RoutedResult does not own the shared handle; cleanup() does.\n\t\t\t\tresults = append(results, r)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tcleanup()\n\t\treturn nil, func() {}, fmt.Errorf(\"resolving ID %s: no issue found matching %q\", id, id)","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/close.go#L720-L756","documentation":"Wraps a lower-level storage/routing failure encountered while resolving one issue ID during `bd close`. `resolveCloseTargets` tries the local store first, then prefix routing; any non-'not found' error from the local store aborts resolution and is wrapped with the offending ID so the user knows which argument failed.","triggerScenarios":"Calling `bd close <id>` where the local store lookup for `<id>` returns an error other than not-found — e.g. the Dolt database is corrupt/unreachable, the store fails to open, or the read transaction errors.","commonSituations":"Corrupt or locked .beads/Dolt database, BEADS_DIR pointing at an uninitialized workspace, disk I/O failure, or a mid-upgrade schema mismatch when closing an issue.","solutions":["Run `bd doctor` to check store health and repair the local database","Verify the workspace: check BEADS_DIR and that .beads/ contains a valid database","Retry after confirming no other process holds a conflicting lock on the store","If the database is unrecoverable, re-clone/sync via `bd dolt pull` to restore issue data"],"exampleFix":"// before\ncleanup()\nreturn nil, func() {}, fmt.Errorf(\"resolving ID %s: %w\", id, err)\n// after\n// no code fix — repair the store first:\n//   bd doctor\n//   bd dolt pull","handlingStrategy":"try-catch","validationCode":"// verify workspace/store health before closing\nbd doctor && bd show <id>","typeGuard":null,"tryCatchPattern":"// exit code != 0 with 'resolving ID <id>: ...'\nif !bd close \"$ID\"; then\n  bd doctor\n  exit 1\nfi","preventionTips":["Run bd doctor periodically to catch store corruption early","Avoid pointing BEADS_DIR at unverified paths","Keep bd and the Dolt store schema on matching versions","Sync (`bd dolt pull`) before bulk closes"],"tags":["cli","storage","issue-resolution"],"backgroundTag":"issue-id-resolution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}