{"record":{"id":"0589f112f3248707","repo":"gastownhall/beads","slug":"adding-comment-w","errorCode":null,"errorMessage":"adding comment: %w","messagePattern":"adding comment: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/comments_proxied_server.go","lineNumber":140,"sourceCode":"// result type carrying presentation for one front door is a result type that\n// grows one field per front door. The role is handed the canonical id the\n// pre-flight resolved, exactly as `bd show` hands Reader.Get one.\nfunc addCommentProxied(ctx context.Context, id, author, text string) (*types.Comment, *types.Issue, error) {\n\tissue, err := resolveCommentTargetProxied(ctx, id)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tcommenter, err := proxiedCommenter()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tresult, err := commenter.AddComment(ctx, issueops.AddCommentRequest{\n\t\tAuthor:  author,\n\t\tIssueID: issue.ID,\n\t\tText:    text,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"adding comment: %w\", err)\n\t}\n\treturn result.Comment, issue, nil\n}\n\n// resolveCommentTargetProxied resolves the anchor and applies the CLI's own\n// pre-flight policy. It reads in a unit of work of its own and writes nothing,\n// so the role's request stays the whole of the transaction.\nfunc resolveCommentTargetProxied(ctx context.Context, id string) (*types.Issue, error) {\n\tuw, err := proxiedOpenReadUOW(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer uw.Close(ctx)\n\n\tissue, _, err := workapi.GetIssueOrWisp(ctx, workapi.NewUOWDetailSource(uw), id)\n\tif errors.Is(err, storage.ErrNotFound) {\n\t\treturn nil, fmt.Errorf(\"issue %s not found\", id)\n\t}","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/comments_proxied_server.go#L122-L158","documentation":"Error \"adding comment: %w\" thrown in gastownhall/beads.","triggerScenarios":"Thrown at cmd/bd/comments_proxied_server.go:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error for the underlying storage failure and fix it","Retry the comment submission after the cause is resolved"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// resolve target first so storage failures are separated from write failures\nbd show \"$ID\" >/dev/null || exit 1","typeGuard":null,"tryCatchPattern":"if ! bd comment \"$ID\" --text \"$T\"; then\n  echo \"comment add failed; check server health and issue state\"\nfi","preventionTips":["Confirm the issue exists and is updatable before commenting","Ensure proxied server storage is healthy (bd doctor)","Avoid commenting on closed/frozen issues when policy forbids it","Retry transient failures after checking server logs"],"tags":[],"backgroundTag":null,"analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}