{"record":{"id":"3ad32c69d9f0e69f","repo":"multica-ai/multica","slug":"add-comment-w","errorCode":null,"errorMessage":"add comment: %w","messagePattern":"add comment: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_issue.go","lineNumber":2015,"sourceCode":"\tfor _, att := range pending {\n\t\tid, uploadErr := client.UploadFile(ctx, att.data, att.path, issueID)\n\t\tif uploadErr != nil {\n\t\t\treturn fmt.Errorf(\"upload attachment %s: %w\", att.path, uploadErr)\n\t\t}\n\t\tattachmentIDs = append(attachmentIDs, id)\n\t\tfmt.Fprintf(os.Stderr, \"Uploaded %s\\n\", att.path)\n\t}\n\n\tbody := map[string]any{\"content\": content}\n\tif parentID, _ := cmd.Flags().GetString(\"parent\"); parentID != \"\" {\n\t\tbody[\"parent_id\"] = parentID\n\t}\n\tif len(attachmentIDs) > 0 {\n\t\tbody[\"attachment_ids\"] = attachmentIDs\n\t}\n\tvar result map[string]any\n\tif err := client.PostJSON(ctx, \"/api/issues/\"+issueID+\"/comments\", body, &result); err != nil {\n\t\treturn fmt.Errorf(\"add comment: %w\", err)\n\t}\n\n\tfmt.Fprintf(os.Stderr, \"Comment added to issue %s.\\n\", issueRef.Display)\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"table\" {\n\t\treturn nil\n\t}\n\treturn cli.PrintJSON(os.Stdout, result)\n}\n\nfunc runIssueCommentDelete(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())","sourceCodeStart":1997,"sourceCodeEnd":2033,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_issue.go#L1997-L2033","documentation":"After attachments (if any) upload, the CLI POSTs the comment body to /api/issues/{id}/comments. This error wraps that POST failing: server-side validation (e.g. invalid parent_id), auth, 4xx/5xx, or transport errors, chained with %w.","triggerScenarios":"Passing a --parent comment ID that does not exist or belongs to another issue; server rejects empty/invalid content; auth expired between resolve and post; 5xx on the server.","commonSituations":"Replying to a deleted parent comment; race where the issue was closed/deleted after resolution; server middleware rejecting the payload.","solutions":["Check the chained cause: 4xx usually names the invalid field (e.g. parent_id).","Re-verify the parent comment ID and the issue still exist.","Retry after transient 5xx/network failures — note attachments may already be uploaded, so a retry can duplicate them.","Inspect server logs for stack traces on persistent 5xx."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# bash: validate the parent exists in this issue before posting a reply\nif [[ -n \"$PARENT\" ]]; then\n  multica issue comment list \"$ISSUE\" --output json | jq -e --arg p \"$PARENT\" 'any(.[]; .id == $p)' >/dev/null \\\n    || { echo \"parent comment $PARENT not found\" >&2; exit 2; }\nfi","typeGuard":null,"tryCatchPattern":"# bash: branch on the wrapped status\nerr=$(multica issue comment add \"$ISSUE\" --content \"$BODY\" 2>&1) || {\n  case \"$err\" in\n    *404*|*parent*) echo \"bad parent/issue ref\" >&2;;\n    *401*|*403*) echo \"auth/permission\" >&2;;\n    *) echo \"transient, safe to retry (attachments may duplicate)\" >&2;;\n  esac\n  exit 1;\n}","preventionTips":["Verify --parent IDs against a fresh comment listing.","Post comments before relying on them; avoid retrying attachment-bearing adds blindly."],"tags":["cli","http","api-client","comments"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}