{"record":{"id":"f13116ec1921c14e","repo":"gastownhall/beads","slug":"copy-comment-for-s-w","errorCode":null,"errorMessage":"copy comment for %s: %w","messagePattern":"copy comment for (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/migrate_personal.go","lineNumber":235,"sourceCode":"\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\n}\n\nfunc pluralIssue(n int) string {\n\tif n == 1 {\n\t\treturn \"issue\"\n\t}\n\treturn \"issues\"\n}\n","sourceCodeStart":217,"sourceCodeEnd":248,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/migrate_personal.go#L217-L248","documentation":"Comments are copied with dst.ImportIssueComment (preserving original author and created_at). If that write fails, migration aborts with this error for the issue.","triggerScenarios":"dst.ImportIssueComment(ctx, issue.ID, c.Author, c.Text, c.CreatedAt) errors — destination driver write failure, DB lock, or invalid comment payload (e.g. nil/zero CreatedAt rejected by the driver).","commonSituations":"Destination DB locked by another bd session, or a comment with malformed author/timestamp data tripping a driver constraint.","solutions":["Check the wrapped inner error to find the failing write cause.","Close competing bd processes and retry the migration.","Validate comment rows in the source (non-empty author/timestamp) before migrating; repair the source if a row is malformed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// validate comment payloads before import\nfor _, c := range comments {\n    if c.CreatedAt.IsZero() || c.Author == \"\" {\n        return fmt.Errorf(\"comment for %s has invalid author/timestamp\", issue.ID)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Sanity-check author/created_at in source comments before migrating.","Keep the destination unlocked during migration.","If driver rejects a payload, repair the source row and re-run."],"tags":["migration","comments","storage","dolt"],"backgroundTag":"storage-write-failure","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}