TryGhost/Ghost · warning · Error
Failed to unlike comment
Error message
Failed to unlike comment
What it means
comments.unlike() DELETEs /members/api/comments/{comment.id}/like with a body of {comments: [comment]} to remove a like. Returns 'Success' on ok, throws on non-ok. The DELETE-with-body pattern is unusual but matches this API's convention.
Source
Thrown at apps/comments-ui/src/utils/api.ts:302
});
},
unlike({comment}: {comment: {id: string}}) {
const body = {
comments: [comment]
};
const url = endpointFor({type: 'members', resource: `comments/${comment.id}/like`});
return makeRequest({
url,
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
}).then(function (res) {
if (res.ok) {
return 'Success';
} else {
throw new Error('Failed to unlike comment');
}
});
},
dislike({comment}: {comment: {id: string}}) {
const url = endpointFor({type: 'members', resource: `comments/${comment.id}/dislike`});
return makeRequest({
url,
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
}).then(function (res) {
if (res.ok) {
return 'Success';
} else {
throw new Error('Failed to dislike comment');
}
});View on GitHub (pinned to 47d8b0e2ad)
Solutions
- Check the Network tab DELETE response status.
- Optimistically toggle the UI and revert on error; debounce the button.
- If 404, sync local state to 'not liked' since the like or comment no longer exists.
- If 401, re-authenticate before retrying.
Defensive patterns
Strategy: try-catch
Try / catch
setLiked(false);
try {
await api.comments.unlike({comment});
} catch (e) {
setLiked(true); // roll back
if (e instanceof Error && e.message === 'Failed to unlike comment') {
// sync state from server
}
} Prevention
- Disable the button during the DELETE to prevent duplicate toggles.
- Use optimistic UI with rollback.
- On 404, sync local state to 'not liked' since the target is gone.
When it happens
Trigger: The DELETE returns 4xx/5xx. The member did not previously like the comment (may be 404/409), the session expired (401), the comment was deleted (404), or the server errors (5xx).
Common situations: A member removes a like on a comment that was deleted server-side. A session expiry mid-session. A race where the like was already removed by another tab/request.
Related errors
- Failed to like comment
- Failed to dislike comment
- Failed to undislike comment
- Failed to fetch site data
- Failed to fetch comments
AI-assisted analysis of TryGhost/Ghost@47d8b0e2ad (2026-08-13).
Data as JSON: /api/errors/840ee03f10bce9fb.
Report an issue: GitHub.