gastownhall/beads · error

failed to compute migration set: %w

Error message

failed to compute migration set: %w

What it means

This error wraps failures from expandMigrationSet during step 3 of `bd migrate-issues`, which expands the candidate set C into the full migration set M according to --include (e.g. including dependencies). It means dependency expansion or cross-repo edge counting failed before the plan was built. The underlying cause is in the wrapped error.

Source

Thrown at cmd/bd/migrate_issues.go:158

	candidates, err := findCandidateIssues(ctx, s, p)
	if err != nil {
		return fmt.Errorf("failed to find candidate issues: %w", err)
	}

	if len(candidates) == 0 {
		if jsonOutput {
			return outputJSON(map[string]interface{}{
				"message": "No issues match the specified filters",
			})
		}
		fmt.Println("Nothing to do: no issues match the specified filters")
		return nil
	}

	// Step 3: Expand set to M (migration set) based on --include
	migrationSet, dependencyStats, err := expandMigrationSet(ctx, s, candidates, p)
	if err != nil {
		return fmt.Errorf("failed to compute migration set: %w", err)
	}

	// Step 4: Check for orphaned dependencies
	orphans, err := checkOrphanedDependencies(ctx, s)
	if err != nil {
		return fmt.Errorf("failed to check dependencies: %w", err)
	}

	if len(orphans) > 0 && p.strict {
		return fmt.Errorf("strict mode: found %d orphaned dependencies", len(orphans))
	}

	// Step 5: Build migration plan
	plan := buildMigrationPlan(candidates, migrationSet, dependencyStats, orphans, p.from, p.to)

	// Step 6: Display plan
	if err := displayMigrationPlan(plan, p.dryRun); err != nil {
		return err

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped error to find the failing dependency query
  2. Run `bd doctor` to check dependency-table integrity
  3. Retry the command; transient Dolt lock/contention is a common cause
  4. Reduce the candidate set with tighter filters to shrink the expansion workload

Example fix

// before
migrationSet, dependencyStats, err := expandMigrationSet(ctx, s, candidates, p)
if err != nil {
    return fmt.Errorf("failed to compute migration set: %w", err)
}
// after: surface the include mode for diagnosis
if err != nil {
    return fmt.Errorf("failed to compute migration set (include=%q): %w", p.include, err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// dry-run first: plan without executing to exercise expansion safely
bd migrate-issues --from old-repo --to new-repo --dry-run

Try / catch

err := runMigrate()
if err != nil && strings.Contains(err.Error(), "failed to compute migration set") {
    log.Printf("expansion failed: %v", errors.Unwrap(err))
}

Prevention

When it happens

Trigger: expandMigrationSet(ctx, s, candidates, p) returns an error, typically propagated from countCrossRepoEdges when GetDependencyRecordsForIssues or GetAllDependencyRecords fails.

Common situations: Large migrations where dependency graph traversal hits a storage error; database connectivity loss mid-command; corrupted dependency rows referencing missing issues.

Related errors


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