{"record":{"id":"a5d861506c06f345","repo":"gastownhall/beads","slug":"failed-to-resolve-dependency-source-s-v","errorCode":null,"errorMessage":"Failed to resolve dependency source %s: %v","messagePattern":"Failed to resolve dependency source (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/tracker/engine.go","lineNumber":1331,"sourceCode":"// createDependencies creates dependencies from the pending list, matching\n// external IDs to local issue IDs. Returns the number of dependencies that\n// failed to resolve or create.\nfunc (e *Engine) createDependencies(ctx context.Context, deps []DependencyInfo) int {\n\tif len(deps) == 0 {\n\t\treturn 0\n\t}\n\n\tresolveIssue, err := e.dependencyIssueResolver(ctx, nil)\n\tif err != nil {\n\t\te.warn(\"Failed to build dependency resolver: %v\", err)\n\t\treturn len(deps)\n\t}\n\n\terrCount := 0\n\tfor _, dep := range deps {\n\t\tfromIssue, err := resolveIssue(ctx, dep.FromExternalID)\n\t\tif err != nil {\n\t\t\te.warn(\"Failed to resolve dependency source %s: %v\", dep.FromExternalID, err)\n\t\t\terrCount++\n\t\t\tcontinue\n\t\t}\n\t\ttoIssue, err := resolveIssue(ctx, dep.ToExternalID)\n\t\tif err != nil {\n\t\t\te.warn(\"Failed to resolve dependency target %s: %v\", dep.ToExternalID, err)\n\t\t\terrCount++\n\t\t\tcontinue\n\t\t}\n\n\t\tif fromIssue == nil || toIssue == nil {\n\t\t\tcontinue // Not found (no error) — expected if issue wasn't imported\n\t\t}\n\n\t\td := &types.Dependency{\n\t\t\tIssueID:     fromIssue.ID,\n\t\t\tDependsOnID: toIssue.ID,\n\t\t\tType:        types.DependencyType(dep.Type),","sourceCodeStart":1313,"sourceCodeEnd":1349,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/tracker/engine.go#L1313-L1349","documentation":"During dependency import, the resolver failed (errored, not merely 'not found') while looking up the source issue of a dependency by its external ID. The dependency is skipped and counted as failed; other dependencies continue. A nil result with no error is treated as expected (issue never imported) and does not warn.","triggerScenarios":"resolveIssue(ctx, dep.FromExternalID) returns a non-nil error — storage query failure while scanning external_ref index, DB lock, or malformed lookup — for the dependency's From side.","commonSituations":"DB contention during a large pull; corrupted external_ref values causing lookup errors; storage driver transient failure mid-import.","solutions":["Read the wrapped error to distinguish storage failure from data problems.","Re-run `bd pull` after fixing storage issues; unresolved dependencies are retried.","Check that the referenced external IDs in the tracker are well-formed.","Verify the dependency-owning issues were themselves imported (both endpoints must exist locally).","Use `bd doctor` or storage checks if lookup errors persist across runs."],"exampleFix":"// before: dependency references an issue that was filtered out of the pull\nbd pull --type=bug\n// after: pull all types so dependency endpoints exist\nbd pull","handlingStrategy":"validation","validationCode":"// validate dependency external IDs before pulling\nfor _, dep := range deps {\n    if dep.FromExternalID == \"\" || dep.ToExternalID == \"\" {\n        log.Printf(\"dependency with empty endpoint: %+v\", dep)\n    }\n    if !tracker.IsExternalRef(dep.FromExternalID) || !tracker.IsExternalRef(dep.ToExternalID) {\n        log.Printf(\"malformed dependency endpoint: %+v\", dep)\n    }\n}","typeGuard":null,"tryCatchPattern":"// re-run pull to retry failed edge resolutions\nstats, err := engine.Sync(ctx, opts)\nif stats != nil && stats.FailedDeps > 0 {\n    time.Sleep(time.Second)\n    engine.Sync(ctx, opts)\n}","preventionTips":["Import dependency endpoints (avoid narrow type/state filters)","Sanitize external IDs at the adapter boundary","Retry pulls after transient storage errors","Audit tracker links for endpoints that were never imported"],"tags":["sync","dependencies","storage","lookup"],"backgroundTag":"dependency-endpoint-unresolved","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}