{"record":{"id":"a2f47fb7f2b0b666","repo":"gastownhall/beads","slug":"error-finding-descendants-v","errorCode":null,"errorMessage":"error finding descendants: %v","messagePattern":"error finding descendants: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/list_show_filter_modes.go","lineNumber":71,"sourceCode":"\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}\n\n\t// Include the parent as the tree root only when descendants exist,\n\t// so the tree renderer can draw the hierarchy with the parent at the top.\n\tallDescendants[parentID] = parentIssue\n\n\ttreeIssues := make([]*types.Issue, 0, len(allDescendants))\n\tfor _, issue := range allDescendants {\n\t\ttreeIssues = append(treeIssues, issue)\n\t}\n\n\treturn treeIssues, nil\n}\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/list_show_filter_modes.go#L53-L89","documentation":"After verifying the parent exists, getHierarchicalChildren calls findAllDescendants to recursively collect all children/descendants. If that recursive traversal fails (storage error, query failure), the underlying error is wrapped with this message.","triggerScenarios":"Any error surfaced from findAllDescendants while expanding `bd list --parent <id>` or the watched-issues hierarchy: database query failure, malformed baseFilter, storage-layer connectivity problems, or a corrupted dependency graph row.","commonSituations":"Embedded Dolt database locked or corrupted; I/O errors reading the store; failure happens only for large/deep hierarchies when a query times out; regression after a schema change.","solutions":["Re-run the command — transient storage errors often clear on retry","Check the wrapped error text for the underlying storage cause","Run `bd doctor` to validate the local database","Restore/repair the beads database if corruption is reported"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"bd\", \"list\", \"--parent\", parentID).CombinedOutput()\nif err != nil {\n    if strings.Contains(string(out), \"error finding descendants\") {\n        // retry or run `bd doctor` to check storage health\n    }\n    return err\n}","preventionTips":["Run `bd doctor` periodically to catch storage issues early","Keep hierarchies shallow or paginate large graphs","Retry transient storage failures once before escalating"],"tags":["cli","storage","recursion"],"backgroundTag":"descendant-lookup-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}