{"record":{"id":"a238424b5bd08c10","repo":"gastownhall/beads","slug":"failed-to-get-dependencies-for-s-w-a23842","errorCode":null,"errorMessage":"failed to get dependencies for %s: %w","messagePattern":"failed to get dependencies for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/template.go","lineNumber":113,"sourceCode":"\t}\n\n\tsubgraph := &TemplateSubgraph{\n\t\tRoot:     root,\n\t\tIssues:   []*types.Issue{root},\n\t\tIssueMap: map[string]*types.Issue{root.ID: root},\n\t}\n\n\t// Recursively load all children (with cycle detection, GH#2719)\n\tvisited := map[string]bool{root.ID: true}\n\tif err := loadDescendants(ctx, s, subgraph, root.ID, visited); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Load all dependencies within the subgraph\n\tfor _, issue := range subgraph.Issues {\n\t\tdeps, err := s.GetDependencyRecords(ctx, issue.ID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get dependencies for %s: %w\", issue.ID, err)\n\t\t}\n\t\tfor _, dep := range deps {\n\t\t\t// Only include dependencies where both ends are in the subgraph\n\t\t\tif _, ok := subgraph.IssueMap[dep.DependsOnID]; ok {\n\t\t\t\tsubgraph.Dependencies = append(subgraph.Dependencies, dep)\n\t\t\t}\n\t\t}\n\t}\n\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).","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/template.go#L95-L131","documentation":"After loading the template root, loadTemplateSubgraph iterates every issue in the subgraph and calls s.GetDependencyRecords to collect dependencies. If the storage layer fails to read dependency records for any issue, the operation aborts with 'failed to get dependencies for %s: %w' wrapping the underlying error. This is a storage-read failure, not a data-shape problem — dependencies that fall outside the subgraph are simply filtered, not errors.","triggerScenarios":"GetDependencyRecords returning an error for any issue in the template subgraph: database corruption of dependency tables, a closed/failed transaction, driver-level I/O failure, or Dolt connection errors mid-operation.","commonSituations":"Corrupt or partially-migrated .beads Dolt database; disk full during a large clone; concurrent `bd` processes causing transaction conflicts; embedded Dolt driver failures.","solutions":["Read the wrapped cause (%w) — fix the underlying storage error it reports first.","Run `bd doctor` to diagnose database health and repair common corruption issues.","Retry the command; transient driver/transaction failures often clear on retry.","Back up and re-sync the database (bd dolt pull) if dependency data is corrupt."],"exampleFix":"// before (storage layer error)\ndeps, err := s.GetDependencyRecords(ctx, issue.ID)\n// caller fix: inspect wrapped error\nfmt.Printf(\"%+v\\n\", errors.Unwrap(err))","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"deps, err := s.GetDependencyRecords(ctx, issue.ID)\nif err != nil {\n\treturn fmt.Errorf(\"failed to get dependencies for %s: %w\", issue.ID, err)\n}\n// at caller: retry once on transient storage errors after unwrapping cause","preventionTips":["Keep the Dolt database healthy with periodic `bd doctor` runs.","Avoid concurrent `bd` writes during template operations.","Monitor disk space in repos with large templates."],"tags":["storage","dependencies","database","template"],"backgroundTag":"dependency-read-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}