TryGhost/Ghost · error · Error

Failed to fetch replies

Error message

Failed to fetch replies

What it means

comments.replies() GETs /members/api/comments/{commentId}/replies to load paginated replies for a parent comment. The async/await variant (unlike the .then variant used by browse) checks res.ok and throws on non-ok. When limit is 'all', replies() recurses page-by-page and any page failure propagates the throw.

Source

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

                }

                if (afterReplyId) {
                    params.set('filter', `id:>'${afterReplyId}'`);
                }

                const url = endpointFor({type: 'members', resource: `comments/${commentId}/replies`, params: `?${params.toString()}`});
                const res = await makeRequest({
                    url,
                    method: 'GET',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    credentials: 'same-origin'
                });
                if (res.ok) {
                    return res.json();
                } else {
                    throw new Error('Failed to fetch replies');
                }
            },
            add({comment}: {comment: AddComment}) {
                const body = {
                    comments: [comment]
                };
                const url = endpointFor({type: 'members', resource: 'comments'});
                return makeRequest({
                    url,
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify(body)
                }).then(function (res) {
                    if (res.ok) {
                        return res.json();
                    } else {

View on GitHub (pinned to 47d8b0e2ad)

Solutions

  1. Check the Network tab for the replies GET status code and the specific commentId in the URL.
  2. If 404, the parent comment no longer exists — handle gracefully by hiding the reply toggle.
  3. For 'all' mode failures, consider catching per-page and returning partial results with a retry option.
  4. If 401, re-establish the member session before retrying.
Defensive patterns

Strategy: try-catch

Validate before calling

function isValidCommentId(commentId: string): boolean {
  return typeof commentId === 'string' && commentId.length > 0;
}

Try / catch

try {
  const data = await api.comments.replies({commentId});
} catch (e) {
  if (e instanceof Error && e.message === 'Failed to fetch replies') {
    // hide the replies section or show retry
  }
}

Prevention

When it happens

Trigger: The replies GET returns 4xx/5xx. The commentId does not exist or was deleted (404), the member lacks permission (401/403), the server errors (5xx), or a page cursor is out of range. In 'all' mode, a failure on page 2+ aborts the whole accumulation after some replies were already fetched.

Common situations: A user opens a comment whose parent was deleted between the thread render and the replies fetch. The session expires mid-pagination. A deep 'load all replies' request hits a transient 502 on an inner page.

Related errors


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