{"record":{"id":"33400e801b43a214","repo":"TryGhost/Ghost","slug":"failed-to-read-comment","errorCode":null,"errorMessage":"Failed to read comment","messagePattern":"Failed to read comment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/comments-ui/src/utils/api.ts","lineNumber":266,"sourceCode":"                }).then(function (res) {\n                    if (res.ok) {\n                        return res.json();\n                    } else {\n                        throw new Error('Failed to edit comment');\n                    }\n                });\n            },\n            read(commentId: string) {\n                const url = endpointFor({type: 'members', resource: `comments/${commentId}`});\n                return makeRequest({\n                    url,\n                    method: 'GET',\n                    credentials: 'same-origin'\n                }).then(function (res) {\n                    if (res.ok) {\n                        return res.json();\n                    } else {\n                        throw new Error('Failed to read comment');\n                    }\n                });\n            },\n            like({comment}: {comment: {id: string}}) {\n                const url = endpointFor({type: 'members', resource: `comments/${comment.id}/like`});\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 like comment');\n                    }\n                });","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/TryGhost/Ghost/blob/47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe/apps/comments-ui/src/utils/api.ts#L248-L284","documentation":"comments.read() GETs /members/api/comments/{commentId} to mark a comment as read by the member (typically for unread-state tracking). It uses credentials: same-origin and throws on a non-ok response. Unlike the write operations, this is a GET with no body.","triggerScenarios":"The GET returns 4xx/5xx. The commentId does not exist (404), the member session expired (401), the member lacks permission (403), or the server errors (5xx). Since this is often called opportunistically (to clear unread badges), failures may be non-critical.","commonSituations":"A background read-marking call fires after a comment was deleted. The session cookie expired between page load and the read call. A transient network error returns 502.","solutions":["Treat read-marking failures as non-blocking — catch and suppress in the UI so the user is unaffected.","Check the Network tab if read states are consistently wrong.","If 401, re-establish the session; read state will sync on next authenticated load.","If 404, remove the comment from local unread state since it no longer exists."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// read-marking is non-critical; swallow errors\ntry {\n  await api.comments.read(commentId);\n} catch {\n  // ignore — read state will sync on next authenticated load\n}","preventionTips":["Treat comments.read() failures as non-blocking; never let them crash the UI.","Catch and suppress to keep the unread-state feature resilient.","If read states are consistently wrong, check the Network tab for the underlying status."],"tags":["network","fetch","comments-ui","comments","read-state"],"backgroundTag":null,"analyzedSha":"47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe","analyzedAt":"2026-08-13T01:25:26.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}