TryGhost/Ghost · warning · Error

Failed to undislike comment

Error message

Failed to undislike comment

What it means

comments.undislike() DELETEs /members/api/comments/{comment.id}/dislike with a body of {comments: [comment]} to remove a dislike. Returns 'Success' on ok, throws on non-ok. Structurally identical to unlike() but for the dislike reaction.

Source

Thrown at apps/comments-ui/src/utils/api.ts:338

                });
            },
            undislike({comment}: {comment: {id: string}}) {
                const body = {
                    comments: [comment]
                };
                const url = endpointFor({type: 'members', resource: `comments/${comment.id}/dislike`});
                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 undislike comment');
                    }
                });
            },
            report({comment}: {comment: {id: string}}) {
                const url = endpointFor({type: 'members', resource: `comments/${comment.id}/report`});
                return makeRequest({
                    url,
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }).then(function (res) {
                    if (res.ok) {
                        return 'Success';
                    } else {
                        throw new Error('Failed to report comment');
                    }
                });

View on GitHub (pinned to 47d8b0e2ad)

Solutions

  1. Check the Network tab DELETE response status.
  2. Optimistically toggle and revert on error; debounce the button.
  3. If 404, sync local state to 'not disliked' since the target no longer exists.
  4. If 403 due to labs, hide the dislike UI and refresh settings.
Defensive patterns

Strategy: try-catch

Try / catch

setDisliked(false);
try {
  await api.comments.undislike({comment});
} catch (e) {
  setDisliked(true);
  if (e instanceof Error && e.message === 'Failed to undislike comment') {
    // sync from server or refresh labs on 403
  }
}

Prevention

When it happens

Trigger: The DELETE returns 4xx/5xx. The member did not dislike the comment (404/409), session expired (401), the comment was deleted (404), dislikes labs flag disabled (403), or server error (5xx).

Common situations: A member removes a dislike on a deleted comment. Labs flag toggled off mid-session. A race with another client already removing the dislike.

Related errors


AI-assisted analysis of TryGhost/Ghost@47d8b0e2ad (2026-08-13). Data as JSON: /api/errors/45bdf0604d01c1de. Report an issue: GitHub.