gatsbyjs/gatsby · error
Did not recognize ${curr}
Error message
Did not recognize ${curr} What it means
Thrown by the plugin-babel-utils AST reducer when it encounters an object property node that has neither a recognized value nor a nested ObjectExpression. The reducer walks plugin option nodes parsed from babel and only knows how to extract literal/template values; any other AST shape is rejected so silently-wrong option extraction cannot happen.
Source
Thrown at packages/gatsby-cli/src/handlers/plugin-babel-utils.ts:34
const getObjectFromNode = (nodeValue: any): any => {
if (!nodeValue || !nodeValue.properties) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return getValueFromNode(nodeValue)
}
const props = nodeValue.properties.reduce((acc, curr) => {
let value = null
if (curr.value) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
value = getValueFromNode(curr.value)
} else if (t.isObjectExpression(curr.value)) {
value = curr.value.expression.properties.reduce((acc, curr) => {
acc[getKeyNameFromAttribute(curr)] = getObjectFromNode(curr)
return acc
}, {})
} else {
throw new Error(`Did not recognize ${curr}`)
}
acc[getKeyNameFromAttribute(curr)] = value
return acc
}, {})
return props
}
const getValueFromNode = (node: any): any => {
if (t.isTemplateLiteral(node)) {
// @ts-ignore - fix me
delete node.leadingComments
// @ts-ignore - fix me
delete node.trailingComments
// @ts-ignore - fix me
const literalContents = generate(node).code
return unwrapTemplateLiteral(literalContents)View on GitHub (pinned to 8b06340921)
Solutions
- Inspect the offending property node (the `${curr}` stringified in the message) to identify which option key triggered it.
- Rewrite that option as a plain literal, array, or nested object literal so the reducer recognizes it.
- If a spread is needed, inline the spread values into the plugin options object.
- Move function-valued options out of the statically-parsed config or guard them with a shape the reducer supports.
Example fix
// before: plugin option uses a spread the reducer cannot parse
plugins: [{ resolve: 'x', options: { ...shared, foo: 'bar' } }]
// after: inline the values
plugins: [{ resolve: 'x', options: { base: 'cfg', foo: 'bar' } }] Defensive patterns
Strategy: validation
Validate before calling
// before calling the reducer, ensure option properties are literal-shaped const isLiteralOption = (node) => !node.value || t.isObjectExpression(node.value) || t.isLiteral(node.value) || t.isTemplateLiteral(node.value)
Type guard
const isRecognizedProperty = (curr): boolean => !!curr.value || t.isObjectExpression(curr.value)
Try / catch
try {
props = nodeValue.properties.reduce(reducer, {})
} catch (e) {
// fall back to skipping the unrecognized option rather than aborting
report.warn(`Skipping unrecognized plugin option node: ${e.message}`)
} Prevention
- Keep plugin options in gatsby-config.js as plain literals/arrays/objects.
- Avoid spreads and function values inside statically-parsed plugin options.
- Test config changes with the consuming CLI before committing.
When it happens
Trigger: Invoking getValueFromNode/reduce over a babel-parsed plugin options object whose property is a SpreadElement, computed key, method shorthand, or other non-literal node (curr.value falsy and not an ObjectExpression). Happens when gatsby-cli scans a gatsby-config.js whose plugin options contain function expressions, spreads, or computed keys the parser does not handle.
Common situations: Migrating a config that uses a spread (`...baseOptions`) or a function value inside a plugin's options; upgrading gatsby-cli to a version whose babel-utils grammar is stricter; running `gatsby plugin` introspection or telemetry over a non-trivial config.
Related errors
- Your gatsby-config.js format is currently not supported by G
- Did not recognize ${curr}
- BabelPluginRemoveGraphQLQueries: String interpolations are n
- BabelPluginRemoveGraphQLQueries: Unexpected empty graphql ta
- BabelPluginRemoveGraphQLQueries: GraphQL syntax error in que
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/9c101237c1d0603c.
Report an issue: GitHub.