{"record":{"id":"53e486d49cb2a275","repo":"gastownhall/beads","slug":"failed-to-compute-migration-set-w","errorCode":null,"errorMessage":"failed to compute migration set: %w","messagePattern":"failed to compute migration set: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/migrate_issues.go","lineNumber":158,"sourceCode":"\tcandidates, err := findCandidateIssues(ctx, s, p)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to find candidate issues: %w\", err)\n\t}\n\n\tif len(candidates) == 0 {\n\t\tif jsonOutput {\n\t\t\treturn outputJSON(map[string]interface{}{\n\t\t\t\t\"message\": \"No issues match the specified filters\",\n\t\t\t})\n\t\t}\n\t\tfmt.Println(\"Nothing to do: no issues match the specified filters\")\n\t\treturn nil\n\t}\n\n\t// Step 3: Expand set to M (migration set) based on --include\n\tmigrationSet, dependencyStats, err := expandMigrationSet(ctx, s, candidates, p)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to compute migration set: %w\", err)\n\t}\n\n\t// Step 4: Check for orphaned dependencies\n\torphans, err := checkOrphanedDependencies(ctx, s)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to check dependencies: %w\", err)\n\t}\n\n\tif len(orphans) > 0 && p.strict {\n\t\treturn fmt.Errorf(\"strict mode: found %d orphaned dependencies\", len(orphans))\n\t}\n\n\t// Step 5: Build migration plan\n\tplan := buildMigrationPlan(candidates, migrationSet, dependencyStats, orphans, p.from, p.to)\n\n\t// Step 6: Display plan\n\tif err := displayMigrationPlan(plan, p.dryRun); err != nil {\n\t\treturn err","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/migrate_issues.go#L140-L176","documentation":"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.","triggerScenarios":"expandMigrationSet(ctx, s, candidates, p) returns an error, typically propagated from countCrossRepoEdges when GetDependencyRecordsForIssues or GetAllDependencyRecords fails.","commonSituations":"Large migrations where dependency graph traversal hits a storage error; database connectivity loss mid-command; corrupted dependency rows referencing missing issues.","solutions":["Inspect the wrapped error to find the failing dependency query","Run `bd doctor` to check dependency-table integrity","Retry the command; transient Dolt lock/contention is a common cause","Reduce the candidate set with tighter filters to shrink the expansion workload"],"exampleFix":"// before\nmigrationSet, dependencyStats, err := expandMigrationSet(ctx, s, candidates, p)\nif err != nil {\n    return fmt.Errorf(\"failed to compute migration set: %w\", err)\n}\n// after: surface the include mode for diagnosis\nif err != nil {\n    return fmt.Errorf(\"failed to compute migration set (include=%q): %w\", p.include, err)\n}","handlingStrategy":"try-catch","validationCode":"// dry-run first: plan without executing to exercise expansion safely\nbd migrate-issues --from old-repo --to new-repo --dry-run","typeGuard":null,"tryCatchPattern":"err := runMigrate()\nif err != nil && strings.Contains(err.Error(), \"failed to compute migration set\") {\n    log.Printf(\"expansion failed: %v\", errors.Unwrap(err))\n}","preventionTips":["Always run with --dry-run (plan output) before a real migration","Keep dependency records clean; delete deps of deleted issues","Avoid expanding enormous sets — filter to manageable batches","Run bd doctor before large migrations"],"tags":["cli","migrations","dependency-graph"],"backgroundTag":"migrate-dependency-expansion-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}