{"record":{"id":"0d149dc20a7b08f6","repo":"gastownhall/beads","slug":"copy-dependency-s-s-w","errorCode":null,"errorMessage":"copy dependency %s→%s: %w","messagePattern":"copy dependency (.+?)→(.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/migrate_personal.go","lineNumber":221,"sourceCode":"// (maphew review, be-e2nb).\nfunc copyIssueRelations(ctx context.Context, src, dst storage.DoltStorage, issue *types.Issue, actor string) error {\n\tlabels, err := src.GetLabels(ctx, issue.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read labels for %s: %w\", issue.ID, err)\n\t}\n\tfor _, label := range labels {\n\t\tif err := dst.AddLabel(ctx, issue.ID, label, actor); err != nil {\n\t\t\treturn fmt.Errorf(\"copy label %q for %s: %w\", label, issue.ID, err)\n\t\t}\n\t}\n\n\tdeps, err := src.GetDependencyRecords(ctx, issue.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read dependencies for %s: %w\", issue.ID, err)\n\t}\n\tfor _, dep := range deps {\n\t\tif err := dst.AddDependency(ctx, dep, actor); err != nil {\n\t\t\treturn fmt.Errorf(\"copy dependency %s→%s: %w\", dep.IssueID, dep.DependsOnID, err)\n\t\t}\n\t}\n\n\tcomments, err := src.GetIssueComments(ctx, issue.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read comments for %s: %w\", issue.ID, err)\n\t}\n\tfor _, c := range comments {\n\t\t// ImportIssueComment writes a structured comment row preserving the\n\t\t// original author and created_at. AddComment would instead record an\n\t\t// event-style entry that GetIssueComments never returns, silently\n\t\t// dropping the comment from the migrated issue (maphew review, be-e2nb).\n\t\tif _, err := dst.ImportIssueComment(ctx, issue.ID, c.Author, c.Text, c.CreatedAt); err != nil {\n\t\t\treturn fmt.Errorf(\"copy comment for %s: %w\", issue.ID, err)\n\t\t}\n\t}\n\n\treturn nil","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/migrate_personal.go#L203-L239","documentation":"When copying a dependency to the destination with dst.AddDependency fails, the migration aborts with this error identifying the edge (IssueID→DependsOnID).","triggerScenarios":"dst.AddDependency(ctx, dep, actor) errors — e.g. the dependency's target issue (DependsOnID) does not yet exist in the destination, a duplicate dependency, or a driver write failure.","commonSituations":"Migrating issues out of dependency order so a dep references an issue not yet copied, or destination lock contention while another bd process runs.","solutions":["Check the wrapped inner error; if it's a missing DependsOnID, ensure migration copies all referenced issues (full-issue set) rather than a subset.","Close other bd processes locking the destination DB and retry.","If duplicate edges from a prior partial run are the cause, reset the destination and migrate fresh."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure every dependency target exists in the destination set\nfor _, dep := range deps {\n    if !copiedIDs[dep.DependsOnID] {\n        return fmt.Errorf(\"dep target %s not in migration set\", dep.DependsOnID)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Migrate the full issue set (including dependency targets), not a subset.","Don't run concurrent bd commands against the destination during migration.","If a prior partial run left duplicate edges, reset the destination before retrying."],"tags":["migration","dependencies","dolt","storage"],"backgroundTag":"storage-write-failure","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}