{"record":{"id":"a7bee8051ca79c7b","repo":"gastownhall/beads","slug":"failed-to-get-dependency-records-w","errorCode":null,"errorMessage":"failed to get dependency records: %w","messagePattern":"failed to get dependency records: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/migrate_issues.go","lineNumber":434,"sourceCode":"\t}\n\n\treturn deps, nil\n}\n\nfunc countCrossRepoEdges(ctx context.Context, s storage.DoltStorage, migrationSet []string) (dependencyStats, error) {\n\tif len(migrationSet) == 0 {\n\t\treturn dependencyStats{}, nil\n\t}\n\n\tsetMap := make(map[string]bool, len(migrationSet))\n\tfor _, id := range migrationSet {\n\t\tsetMap[id] = true\n\t}\n\n\t// Get all dependency records for migration set issues (outgoing direction)\n\tdepsByIssue, err := s.GetDependencyRecordsForIssues(ctx, migrationSet)\n\tif err != nil {\n\t\treturn dependencyStats{}, fmt.Errorf(\"failed to get dependency records: %w\", err)\n\t}\n\n\t// Count outgoing edges: migrated issues depend on external issues\n\toutgoing := 0\n\tfor _, deps := range depsByIssue {\n\t\tfor _, dep := range deps {\n\t\t\tif !setMap[dep.DependsOnID] {\n\t\t\t\toutgoing++\n\t\t\t}\n\t\t}\n\t}\n\n\t// For incoming edges, we need to find all deps whose resolved target is in\n\t// the migration set but whose issue_id is not. Use GetAllDependencyRecords;\n\t// the returned records expose the target via dep.DependsOnID (resolved from\n\t// the typed columns).\n\tallDeps, err := s.GetAllDependencyRecords(ctx)\n\tif err != nil {","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/migrate_issues.go#L416-L452","documentation":"This error wraps failures from GetDependencyRecordsForIssues inside countCrossRepoEdges, which fetches outgoing dependency records for every issue in the migration set to count edges leaving the set (migrated issues depending on external issues). It means the per-issue dependency lookup failed while computing dependency statistics for the migration plan. The wrapped error carries the storage cause.","triggerScenarios":"s.GetDependencyRecordsForIssues(ctx, migrationSet) returns an error while counting outgoing cross-repo edges during expandMigrationSet.","commonSituations":"Very large migration sets making the batched lookup time out; dependency table corruption referencing deleted issues; database lock contention during an active sync.","solutions":["Read the wrapped error to identify the failing lookup","Shrink the migration set with tighter filters so fewer dependency rows are fetched","Check dependency-table integrity with `bd doctor`","Retry after any concurrent sync/write finishes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# keep the migration set small so the batched dependency lookup stays fast\nbd migrate-issues --from old --to new --label team-a --dry-run --json | jq '.migrationSet | length'","typeGuard":null,"tryCatchPattern":"err := runMigrate()\nif isTransient(err) && strings.Contains(err.Error(), \"failed to get dependency records\") {\n    time.Sleep(2 * time.Second)\n    err = runMigrate() // retry once after transient storage errors\n}","preventionTips":["Migrate in filtered batches rather than thousands of issues at once","Ensure no sync runs concurrently","Prune stale dependency records regularly"],"tags":["cli","dependencies","storage"],"backgroundTag":"dependency-records-fetch-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}