TryGhost/Ghost · warning · Error

Failed to dislike comment

Error message

Failed to dislike comment

What it means

comments.dislike() POSTs to /members/api/comments/{comment.id}/dislike to register a dislike reaction. Mirrors the like() structure: returns 'Success' on ok, throws on non-ok, no body sent. Dislike is a labs-gated feature in Ghost comments.

Source

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

                        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');
                    }
                });
            },
            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';

View on GitHub (pinned to 47d8b0e2ad)

Solutions

  1. Check the Network tab POST response status and body.
  2. Gate the dislike button visibility on the labs flag returned by site.settings() to avoid 403s.
  3. Optimistically update and revert on error; disable the button during the request.
  4. If 401, re-authenticate; if 403, hide the dislike UI and refresh settings.
Defensive patterns

Strategy: validation

Validate before calling

function isDislikesEnabled(labs: {dislikes?: boolean} | undefined): boolean {
  return Boolean(labs?.dislikes);
}

Try / catch

setDisliked(true);
try {
  await api.comments.dislike({comment});
} catch (e) {
  setDisliked(false);
  if (e instanceof Error && e.message === 'Failed to dislike comment') {
    // if 403, dislikes may be disabled — refresh labs
  }
}

Prevention

When it happens

Trigger: The POST returns 4xx/5xx. The member is unauthenticated (401), already disliked (409/400), the comment was deleted (404), the labs flag for dislikes is disabled (403), or rate limited (429).

Common situations: A member dislikes a comment but the site admin disabled the dislike labs feature after the UI rendered the button. Session expiry. A double-click submits two dislikes.

Related errors


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