{"record":{"id":"96fafbb1dc6820de","repo":"gastownhall/beads","slug":"strict-mode-found-d-orphaned-dependencies","errorCode":null,"errorMessage":"strict mode: found %d orphaned dependencies","messagePattern":"strict mode: found (.+?) orphaned dependencies","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/migrate_issues.go","lineNumber":168,"sourceCode":"\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\n\t}\n\n\t// Step 7: Execute migration if not dry-run\n\tif !p.dryRun {\n\t\tif !p.yes && !jsonOutput {\n\t\t\tif !confirmMigration(plan) {\n\t\t\t\tfmt.Println(\"Migration canceled\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/migrate_issues.go#L150-L186","documentation":"This is an intentional strict-mode abort: `bd migrate-issues --strict` refuses to proceed when the migration set contains orphaned dependencies — dependencies whose target issues are outside the migration set. Migrating would leave dangling references in the destination, so the command stops before building the plan. The count in the message tells you how many orphaned edges were found.","triggerScenarios":"len(orphans) > 0 && p.strict in executeMigrateIssues — orphaned dependencies exist and --strict was passed.","commonSituations":"Migrating a filtered subset of issues whose cross-references span repos or labels not included by --include; migrating between repos where the dependency partner lives in the source repo; partial earlier migrations left half-moved dependency graphs.","solutions":["Re-run with --include dependencies (or a wider filter) so linked issues join the migration set","Drop --strict to get a warning instead of an abort, then review the reported orphans","Manually resolve or delete the orphaned dependency records before migrating","Use the JSON output to enumerate orphans and fix them in bulk"],"exampleFix":"// before: aborts\ncmd bd migrate-issues --from old-repo --to new-repo --strict\n// after: include linked deps so no orphans remain\ncmd bd migrate-issues --from old-repo --to new-repo --strict --include dependencies","handlingStrategy":"validation","validationCode":"// pre-check: plan first and inspect the orphan count in JSON output\nbd migrate-issues --from old --to new --include dependencies --dry-run --json | jq '.orphans'\n# only run with --strict when the orphan list is empty","typeGuard":"function hasNoOrphans(planResult) {\n  return Array.isArray(planResult.orphans) && planResult.orphans.length === 0;\n}","tryCatchPattern":null,"preventionTips":["Always pass --include dependencies when issues reference each other","Dry-run with --json and inspect orphans before using --strict","Resolve or delete dangling dependencies before migrating","Migrate whole connected components rather than arbitrary subsets"],"tags":["cli","migrations","strict-mode"],"backgroundTag":"orphaned-dependencies-in-migration-set","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}