{"record":{"id":"c8baa1c8202f6855","repo":"gastownhall/beads","slug":"issue-s-not-found-c8baa1","errorCode":null,"errorMessage":"issue %s not found","messagePattern":"issue (.+?) not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/validation/issue.go","lineNumber":32,"sourceCode":"\n// Chain composes multiple validators into a single validator.\n// Validators are executed in order and the first error stops the chain.\nfunc Chain(validators ...IssueValidator) IssueValidator {\n\treturn func(id string, issue *types.Issue) error {\n\t\tfor _, v := range validators {\n\t\t\tif err := v(id, issue); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}\n\n// Exists validates that an issue is not nil.\nfunc Exists() IssueValidator {\n\treturn func(id string, issue *types.Issue) error {\n\t\tif issue == nil {\n\t\t\treturn fmt.Errorf(\"issue %s not found\", id)\n\t\t}\n\t\treturn nil\n\t}\n}\n\n// NotTemplate validates that an issue is not a template.\n// Templates are read-only and cannot be modified.\nfunc NotTemplate() IssueValidator {\n\treturn func(id string, issue *types.Issue) error {\n\t\tif issue == nil {\n\t\t\treturn nil // Let Exists() handle nil check if needed\n\t\t}\n\t\tif issue.IsTemplate {\n\t\t\treturn fmt.Errorf(\"cannot modify template %s: templates are read-only; use 'bd mol pour' to create a work item\", id)\n\t\t}\n\t\treturn nil\n\t}\n}","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/validation/issue.go#L14-L50","documentation":"Exists() is an IssueValidator that rejects a nil issue. The database lookup for the given issue ID returned no row, so validation fails with 'issue <id> not found' before the operation proceeds.","triggerScenarios":"Calling any update/close/assign path that runs validators with an issue ID that does not exist in the database (typo'd ID, deleted/closed-and-purged issue, wrong database/prefix).","commonSituations":"Typo in a bd issue ID; referencing an issue from another repo's database; issue was deleted by a teammate; stale cached ID after a fresh clone or re-sync.","solutions":["Verify the issue ID with 'bd show <id>' and correct the typo","Run 'bd list' to find the correct issue ID","Check you are operating in the repository/database that owns the issue (check .beads directory)","If the issue was deleted, recreate it with 'bd create'"],"exampleFix":"// before\nbd close bd-42x  // typo'd ID\n// after\nbd list | grep 42  # find correct ID, then\nbd close bd-42","handlingStrategy":"validation","validationCode":"issue, err := store.GetIssue(ctx, id)\nif err != nil || issue == nil {\n    return fmt.Errorf(\"issue %s does not exist; run 'bd list' to find the correct ID\", id)\n}","typeGuard":"func issueExists(issue *types.Issue) bool { return issue != nil }","tryCatchPattern":"if err := doOp(id); err != nil {\n    if strings.Contains(err.Error(), \"not found\") {\n        // refresh from 'bd list' and retry with corrected ID\n    }\n    return err\n}","preventionTips":["Copy issue IDs from 'bd list'/'bd show' output rather than typing them","Verify the ID exists before scripting bulk operations","Check you are in the repository whose .beads database owns the issue"],"tags":["validation","issue-not-found","cli"],"backgroundTag":"resource-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}