gatsbyjs/gatsby · error
{"fetchError":"Could not fetch ${pathOrUrl} from official re
Error message
{"fetchError":"Could not fetch ${pathOrUrl} from official recipes"} What it means
Thrown by `resolveRecipe` (resolve-recipe.js:28) when fetching an official recipe from `https://unpkg.com/gatsby-recipes/recipes/<name>.mdx` returns a non-200 HTTP status. The error is JSON-stringified (`{fetchError: ...}`) so the caller can parse and display it. Only the official-recipe branch (not URL, not relative path) performs this check.
Source
Thrown at deprecated-packages/gatsby-recipes/src/resolve-recipe.js:28
return false
}
export default async function resolveRecipe(pathOrUrl, projectRoot) {
let recipePath
if (isUrl(pathOrUrl)) {
const res = await fetch(pathOrUrl)
const src = await res.text()
return src
}
if (isRelative(pathOrUrl)) {
recipePath = path.join(projectRoot, pathOrUrl)
} else {
const url = `https://unpkg.com/gatsby-recipes/recipes/${pathOrUrl}`
const res = await fetch(url.endsWith(`.mdx`) ? url : url + `.mdx`)
if (res.status !== 200) {
throw new Error(
JSON.stringify({
fetchError: `Could not fetch ${pathOrUrl} from official recipes`,
})
)
}
const src = await res.text()
return src
}
if (recipePath.slice(-4) !== `.mdx`) {
recipePath += `.mdx`
}
const src = await fs.readFile(recipePath, `utf8`)
return src
}
View on GitHub (pinned to 8b06340921)
Solutions
- Check the recipe name spelling against the official recipes list.
- Pass a full URL (`isUrl`) or a relative path to a local `.mdx` file instead of relying on unpkg.
- Verify network connectivity to unpkg.com (curl the URL).
- Retry — unpkg outages are usually transient.
Example fix
// before resolveRecipe(`add-typescriptt`, projectRoot) // after resolveRecipe(`adding-typescript`, projectRoot) // or local file: resolveRecipe(`./recipes/my-recipe.mdx`, projectRoot)
Defensive patterns
Strategy: retry
Validate before calling
async function canFetchRecipe(name) {
const url = `https://unpkg.com/gatsby-recipes/recipes/${name}.mdx`
const res = await fetch(url)
return res.status === 200
} Type guard
function isFetchErrorMessage(msg) {
try { return JSON.parse(msg).fetchError != null } catch { return false }
} Try / catch
try {
await resolveRecipe(name, root)
} catch (e) {
if (isFetchErrorMessage(e.message)) { /* fall back to local file or retry */ }
else throw e
} Prevention
- Prefer local recipe paths in air-gapped environments.
- Validate recipe names against the official catalog before fetching.
- Implement retry/backoff for transient unpkg failures.
When it happens
Trigger: Passing a recipe name that does not exist on unpkg; offline or firewalled environment blocking unpkg.com; unpkg CDN outage; typo in the recipe name; using a recipe that exists only in a newer/older published gatsby-recipes package.
Common situations: Corporate proxy blocking unpkg; typo like `gatsby recipes add-typescriptt`; running `gatsby recipes` with an old globally installed CLI pointing at recipes removed from the current package; transient unpkg downtime.
Related errors
- MissingInfoError
- Your gatsby-config.js format is currently not supported by G
- Did not recognize ${curr}
- A recipe must be specified
- ${JSON.stringify(result)}
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/dca88459677f7bff.
Report an issue: GitHub.