TryGhost/Ghost · warning · Error
Failed to fetch recommendations
Error message
Failed to fetch recommendations
What it means
Thrown in api.site.recommendations() when GET {apiUrl}/recommendations/?limit=... returns non-ok. Message 'Failed to fetch recommendations'. Portal uses recommendations to render the recommended-sites UI.
Source
Thrown at apps/portal/src/utils/api.js:133
} else {
throw new Error('Failed to fetch offer data');
}
});
},
recommendations({limit = 100} = {limit: 100}) {
const url = contentEndpointFor({resource: 'recommendations', params: {limit}});
return makeRequest({
url,
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(function (res) {
if (res.ok) {
return res.json();
} else {
throw new Error('Failed to fetch recommendations');
}
});
}
};
api.feedback = {
async add({uuid, key, postId, score}) {
let url = endpointFor({type: 'members', resource: 'feedback'});
if (uuid && key) { // only necessary if not logged in, and both are required if so
url = url + `?uuid=${uuid}&key=${key}`;
}
const body = {
feedback: [
{
post_id: postId,
score
}
]View on GitHub (pinned to 47d8b0e2ad)
Solutions
- Verify the Ghost server version exposes /api/content/recommendations/.
- Check the Content API key in the Portal data attributes.
- Confirm apiUrl and CORS allow the page origin.
- If unused, consider not rendering the recommendations block to avoid the call entirely.
Example fix
// before
throw new Error('Failed to fetch recommendations');
// after
throw new Error(`Failed to fetch recommendations (${res.status} ${res.statusText})`); Defensive patterns
Strategy: fallback
Validate before calling
// skip the call entirely when recommendations are not shown
function shouldFetchRecommendations(state) {
return state.features?.recommendations && state.showRecommendations;
} Try / catch
try {
return await api.site.recommendations();
} catch (err) {
// non-critical — render empty recommendations
return [];
} Prevention
- Only fetch recommendations when the UI actually renders them.
- Degrade gracefully — recommendations are non-critical.
- Confirm Ghost server version exposes the recommendations content endpoint.
- Keep the Content API key current.
When it happens
Trigger: Portal loads the recommendations content endpoint; non-ok response — no recommendations configured, invalid API key, endpoint not present in older Ghost.
Common situations: Older Ghost version that predates the recommendations content endpoint; rotated/stale Content API key; CORS / apiUrl misconfiguration; recommendations feature disabled in labs on the server.
Related errors
- Failed to fetch site data
- Could not create Stripe checkout session
- Failed to fetch site data
- Failed to fetch offer data
- fallbackMessage
AI-assisted analysis of TryGhost/Ghost@47d8b0e2ad (2026-08-13).
Data as JSON: /api/errors/0cd2dc1176721bbf.
Report an issue: GitHub.