gastownhall/beads · error

failed to check dependencies: %w

Error message

failed to check dependencies: %w

What it means

This error wraps failures from checkOrphanedDependencies during step 4 of `bd migrate-issues`, which detects dependencies in the migration set that point at issues not being migrated. It indicates the orphan-detection query itself failed, not that orphans were found (that is error 1033's strict-mode message). The real cause is in the wrapped error.

Source

Thrown at cmd/bd/migrate_issues.go:164

		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
	}

	// Step 7: Execute migration if not dry-run
	if !p.dryRun {
		if !p.yes && !jsonOutput {
			if !confirmMigration(plan) {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped inner error for the root cause
  2. Check database integrity with `bd doctor`
  3. Retry after confirming no competing bd process is writing
  4. If the dependency table is large, ensure the storage backend has adequate resources
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the store is healthy and no other process is writing before migrating
bd doctor
# verify no concurrent bd sync is running

Try / catch

if err := runMigrate(); err != nil {
    if unwrapped := errors.Unwrap(err); unwrapped != nil {
        log.Printf("orphan check failed: %v", unwrapped)
    }
    return err
}

Prevention

When it happens

Trigger: checkOrphanedDependencies(ctx, s) returns a non-nil error while querying dependency records for the migration set.

Common situations: Storage engine errors during dependency scans; context deadline exceeded on very large dependency tables; database file corruption after an interrupted sync.

Related errors


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