{"record":{"id":"5289f26f2fc6bee2","repo":"gastownhall/beads","slug":"read-dependencies-for-s-w","errorCode":null,"errorMessage":"read dependencies for %s: %w","messagePattern":"read dependencies for (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/migrate_personal.go","lineNumber":217,"sourceCode":"// single issue from src to dst. The issue row itself must already exist in dst\n// (created in phase 1a of runMigratePersonal). Every step — including the reads\n// from src — is fatal on error so the caller can abort the migration before any\n// source data is deleted; a partial copy must never be mistaken for success\n// (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)","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/migrate_personal.go#L199-L235","documentation":"copyIssueRelations reads the issue's dependency records from the source via src.GetDependencyRecords; a read failure aborts the migration with this wrapped error.","triggerScenarios":"src.GetDependencyRecords(ctx, issue.ID) returns an error during migration — driver error, corrupted dependency rows, or source DB inaccessible.","commonSituations":"Migrating an issue whose dependency table references are inconsistent after an earlier interrupted copy, or source Dolt DB lock/IO error.","solutions":["Inspect the wrapped inner error for the driver-level cause.","Run bd doctor / bd deps on the source DB to verify dependency integrity before migrating.","Fix storage access and re-run the migration; abort-before-delete semantics make retries safe."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-flight: confirm dependency records are readable for every issue\nfor _, iss := range issues {\n    if _, err := src.GetDependencyRecords(ctx, iss.ID); err != nil {\n        return fmt.Errorf(\"pre-flight deps %s: %w\", iss.ID, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run bd doctor on the source before migrating.","Avoid migrating from a DB that had a previously interrupted write.","Fix inner driver error before retrying; migration is safe to re-run."],"tags":["migration","storage","dependencies","dolt"],"backgroundTag":"storage-read-failure","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}