{"record":{"id":"b32e56c0aaa0ce58","repo":"gastownhall/beads","slug":"error-checking-parent-issue-v","errorCode":null,"errorMessage":"error checking parent issue: %v","messagePattern":"error checking parent issue: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/list_show_filter_modes.go","lineNumber":58,"sourceCode":"// above are what is left over — so this file is now the exception's whole\n// remaining reason rather than one of several. It did not leave the config's\n// exception list with this commit, and the count in issueops/reader.go's claim\n// is unchanged for that reason: three modes here still name the type.\n//\n// Widening the hole is an edit in the config and a diff a reviewer sees.\n\n// getHierarchicalChildren handles the --tree --parent combination logic.\n// baseFilter carries CLI filters (--type, --status, etc.) through the recursive walk.\nfunc getHierarchicalChildren(ctx context.Context, store storage.DoltStorage, dbPath string, parentID string, baseFilter types.IssueFilter) ([]*types.Issue, error) {\n\t// First verify that the parent issue exists\n\tvar parentIssue *types.Issue\n\terr := withStorage(ctx, store, dbPath, func(s storage.DoltStorage) error {\n\t\tvar err error\n\t\tparentIssue, err = s.GetIssue(ctx, parentID)\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error checking parent issue: %v\", err)\n\t}\n\tif parentIssue == nil {\n\t\treturn nil, fmt.Errorf(\"parent issue '%s' not found\", parentID)\n\t}\n\n\t// Use recursive search to find all descendants using the same logic as --parent filter.\n\t// The parent itself is NOT included in the result set — only actual children and\n\t// their descendants. This matches the behavior of --json and --flat (GH#3349).\n\tallDescendants := make(map[string]*types.Issue)\n\n\terr = findAllDescendants(ctx, store, dbPath, parentID, baseFilter, allDescendants)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error finding descendants: %v\", err)\n\t}\n\n\tif len(allDescendants) == 0 {\n\t\treturn nil, nil\n\t}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/list_show_filter_modes.go#L40-L76","documentation":"getHierarchicalChildren verifies the requested parent issue exists before walking descendants; this wraps the storage GetIssue failure for that parent. Note it uses %v (not %w), so the wrapped error is not machine-unwrappable. A successful fetch returning nil leads to the separate 'parent issue not found' error.","triggerScenarios":"`bd list --parent <id>` (hierarchical mode) where the storage GetIssue call for parentID errors — DB open failure, corruption, or storage-layer exception in withStorage.","commonSituations":"Corrupt or missing Dolt database file, wrong dbPath / running outside the repo (.beads dir missing), storage locked by another process, or a transient embedded-store error.","solutions":["Verify the parent ID is correct and the issue exists (`bd show <id>`)","Run `bd doctor` to check database health","Run from the repository root so .beads/ dbPath resolves","If the DB is corrupt, restore from .beads/issues.jsonl export or backup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Verify the parent exists and DB is reachable before hierarchical list\nbd show \"$parent\" >/dev/null 2>&1 || { echo \"parent $parent missing or DB unreachable\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// Distinguish missing parent vs storage failure\nout=$(bd list --parent \"$parent\" 2>&1) || case \"$out\" in\n  *\"not found\"*) exit 2;;  # bad ID\n  *\"error checking parent\"*) bd doctor; exit 1;;  # storage problem\nesac","preventionTips":["Validate parent IDs with `bd show` before --parent lists","Run bd from the repo root so .beads is found","Monitor DB health with `bd doctor`; keep exports/backups for corruption recovery"],"tags":["storage","parent-filter","hierarchy"],"backgroundTag":"parent-issue-lookup-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}