{"record":{"id":"63ca5ee56ef35ee1","repo":"TryGhost/Ghost","slug":"failed-to-report-comment","errorCode":null,"errorMessage":"Failed to report comment","messagePattern":"Failed to report comment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/comments-ui/src/utils/api.ts","lineNumber":354,"sourceCode":"                        return 'Success';\n                    } else {\n                        throw new Error('Failed to undislike comment');\n                    }\n                });\n            },\n            report({comment}: {comment: {id: string}}) {\n                const url = endpointFor({type: 'members', resource: `comments/${comment.id}/report`});\n                return makeRequest({\n                    url,\n                    method: 'POST',\n                    headers: {\n                        'Content-Type': 'application/json'\n                    }\n                }).then(function (res) {\n                    if (res.ok) {\n                        return 'Success';\n                    } else {\n                        throw new Error('Failed to report comment');\n                    }\n                });\n            }\n        },\n        init: (() => {}) as () => Promise<{ member: any; labs: any; supportEmail: string | null}>\n    };\n\n    api.init = async () => {\n        const [member] = await Promise.all([\n            api.member.sessionData()\n        ]);\n\n        let labs = {};\n        let supportEmail: string | null = null;\n\n        try {\n            const settings = await api.site.settings();\n            if (settings.settings.labs) {","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/TryGhost/Ghost/blob/47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe/apps/comments-ui/src/utils/api.ts#L336-L372","documentation":"comments.report() POSTs to /members/api/comments/{comment.id}/report to flag a comment for moderator review. Returns 'Success' on ok, throws on non-ok, no body sent. This is a member-initiated moderation action and is typically rate-limited to prevent abuse.","triggerScenarios":"The POST returns 4xx/5xx. The member is unauthenticated (401), the comment was already reported by this member (409), the comment was deleted (404), the member is banned (403), or rate limiting applies due to repeated reports (429).","commonSituations":"A member reports a comment twice (second report rejected as duplicate). Session expiry. The comment was removed by a moderator before the report request landed. Abuse-prevention rate limiting after multiple reports.","solutions":["Check the Network tab POST response status and body.","If 409 (already reported), show 'You have already reported this comment' and disable the button.","If 429, inform the user to wait before reporting again; implement client-side cooldown.","If 401, re-authenticate; if 404, remove the comment locally."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await api.comments.report({comment});\n  // show 'reported' confirmation\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to report comment') {\n    // 409 already reported, 429 rate limited, 401 auth — branch on status if exposed\n  }\n}","preventionTips":["Implement a client-side cooldown after a report to avoid 429 rate limiting.","Track already-reported comment ids locally to avoid duplicate-report 409s.","Disable the report button immediately on click and re-enable only on failure."],"tags":["network","fetch","comments-ui","report","moderation"],"backgroundTag":null,"analyzedSha":"47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe","analyzedAt":"2026-08-13T01:25:26.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}