gastownhall/beads · error

failed to get dependency records: %w

Error message

failed to get dependency records: %w

What it means

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.

Source

Thrown at cmd/bd/migrate_issues.go:434

	}

	return deps, nil
}

func countCrossRepoEdges(ctx context.Context, s storage.DoltStorage, migrationSet []string) (dependencyStats, error) {
	if len(migrationSet) == 0 {
		return dependencyStats{}, nil
	}

	setMap := make(map[string]bool, len(migrationSet))
	for _, id := range migrationSet {
		setMap[id] = true
	}

	// Get all dependency records for migration set issues (outgoing direction)
	depsByIssue, err := s.GetDependencyRecordsForIssues(ctx, migrationSet)
	if err != nil {
		return dependencyStats{}, fmt.Errorf("failed to get dependency records: %w", err)
	}

	// Count outgoing edges: migrated issues depend on external issues
	outgoing := 0
	for _, deps := range depsByIssue {
		for _, dep := range deps {
			if !setMap[dep.DependsOnID] {
				outgoing++
			}
		}
	}

	// For incoming edges, we need to find all deps whose resolved target is in
	// the migration set but whose issue_id is not. Use GetAllDependencyRecords;
	// the returned records expose the target via dep.DependsOnID (resolved from
	// the typed columns).
	allDeps, err := s.GetAllDependencyRecords(ctx)
	if err != nil {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped error to identify the failing lookup
  2. Shrink the migration set with tighter filters so fewer dependency rows are fetched
  3. Check dependency-table integrity with `bd doctor`
  4. Retry after any concurrent sync/write finishes
Defensive patterns

Strategy: retry

Validate before calling

# keep the migration set small so the batched dependency lookup stays fast
bd migrate-issues --from old --to new --label team-a --dry-run --json | jq '.migrationSet | length'

Try / catch

err := runMigrate()
if isTransient(err) && strings.Contains(err.Error(), "failed to get dependency records") {
    time.Sleep(2 * time.Second)
    err = runMigrate() // retry once after transient storage errors
}

Prevention

When it happens

Trigger: s.GetDependencyRecordsForIssues(ctx, migrationSet) returns an error while counting outgoing cross-repo edges during expandMigrationSet.

Common situations: Very large migration sets making the batched lookup time out; dependency table corruption referencing deleted issues; database lock contention during an active sync.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/a7bee8051ca79c7b. Report an issue: GitHub.