{"record":{"id":"e83d157073ffdd1b","repo":"gastownhall/beads","slug":"failed-to-get-dependents-of-s-w","errorCode":null,"errorMessage":"failed to get dependents of %s: %w","messagePattern":"failed to get dependents of (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/template.go","lineNumber":140,"sourceCode":"\n\treturn subgraph, nil\n}\n\n// loadDescendants recursively loads all child issues.\n// It uses two strategies to find children:\n// 1. Check dependency records for parent-child relationships\n// 2. Check for hierarchical IDs (parent.N) to catch children with missing/wrong deps\n//\n// The visited set tracks IDs already expanded to detect cycles (GH#2719).\n// Without this, cyclic parent-child dependencies cause unbounded recursion leading to OOM.\nfunc loadDescendants(ctx context.Context, s molReader, subgraph *TemplateSubgraph, parentID string, visited map[string]bool) error {\n\t// Track children we've already added to avoid duplicates\n\taddedChildren := make(map[string]bool)\n\n\t// Strategy 1: Get direct parent-child dependents with relationship metadata.\n\tdependents, err := s.GetDependentsWithMetadata(ctx, parentID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get dependents of %s: %w\", parentID, err)\n\t}\n\n\t// Only keep explicit parent-child relationships.\n\tfor _, dependent := range dependents {\n\t\tif dependent.DependencyType != types.DepParentChild {\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, exists := subgraph.IssueMap[dependent.ID]; exists {\n\t\t\tcontinue // Already in subgraph\n\t\t}\n\n\t\t// Cycle detection (GH#2719)\n\t\tif visited[dependent.ID] {\n\t\t\tcontinue\n\t\t}\n\n\t\tchild := dependent.Issue","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/template.go#L122-L158","documentation":"loadDescendants collects the children of a parent issue within a template. It calls s.GetDependentsWithMetadata(parentID) and, if that storage call fails, throws 'failed to get dependents of %s: %w' wrapping the cause. Only DepParentChild relationships are kept afterwards, so the error is purely about reading dependents, not about relationship filtering.","triggerScenarios":"GetDependentsWithMetadata failing for the parent issue while loading a template subgraph (recursively via loadTemplateSubgraph or deeper via loadDescendants): storage read error, transaction failure, or driver error.","commonSituations":"Corrupt dependency index in the Dolt database; interrupted prior `bd` command leaving inconsistent data; concurrent writes conflicting with the read.","solutions":["Inspect the wrapped error via errors.Unwrap to identify the storage-level cause and address it.","Run `bd doctor` to check and repair database integrity.","Retry the operation after any transient driver failure.","Re-sync from remote (bd dolt pull) if local dependency data is inconsistent."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"dependents, err := s.GetDependentsWithMetadata(ctx, parentID)\nif err != nil {\n\treturn fmt.Errorf(\"failed to get dependents of %s: %w\", parentID, err)\n}","preventionTips":["Run `bd doctor` after interrupted commands to catch inconsistent dependency data.","Avoid killing `bd` mid-operation.","Re-sync from remote if local data looks inconsistent."],"tags":["storage","dependents","hierarchy","template"],"backgroundTag":"dependency-read-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}