gatsbyjs/gatsby · error

No support for arrays not at the end of path

Error message

No support for arrays not at the end of path

What it means

While validating nested sub-plugins, Gatsby builds a dotted path and collapses terminal array indices to `[]`. A numeric path segment that is NOT the last segment (i.e. an array nested deeper than the end of the path) has no supported string representation, so validation aborts.

Source

Thrown at packages/gatsby/src/bootstrap/load-plugins/validate.ts:271

                    const resolvedPlugin = resolvePlugin(value, rootDir)
                    const modulePath = require.resolve(
                      `${resolvedPlugin.resolve}${entry ? `/${entry}` : ``}`
                    )
                    value.modulePath = modulePath

                    const normalizedPath = helpers.state.path
                      .map((key, index) => {
                        // if subplugin is part of an array - swap concrete index key with `[]`
                        if (
                          typeof key === `number` &&
                          Array.isArray(
                            helpers.state.ancestors[
                              helpers.state.path.length - index - 1
                            ]
                          )
                        ) {
                          if (index !== helpers.state.path.length - 1) {
                            throw new Error(
                              `No support for arrays not at the end of path`
                            )
                          }
                          return `[]`
                        }

                        return key
                      })
                      .join(`.`)

                    subPluginPaths.add(normalizedPath)
                  } catch (err) {
                    console.log(err)
                  }

                  return value
                })
              }, `Gatsby specific subplugin validation`)

View on GitHub (pinned to 8b06340921)

Solutions

  1. Restructure the plugin's `subPluginPaths`/options so any array of sub-plugins is the terminal element of the config path.
  2. If you do not control the plugin, simplify the config to avoid nested arrays of plugins.
  3. Report the schema shape to the plugin author; this is a structural limitation, not a typo.
Defensive patterns

Strategy: validation

Validate before calling

// For plugin authors: keep arrays of sub-plugins terminal in the options path.
// Validate your schema so nested arrays of plugins are rejected up front:
const BAD = /\.\d+\.[^.]+$/ // numeric segment not at end
function assertFlatSubplugins(optionPath) {
  if (/\.\d+\./.test(optionPath) && !optionPath.endsWith("[]")) {
  throw new Error(`Unsupported nested subplugin array at ${optionPath}`)
  }
}

Prevention

When it happens

Trigger: A plugin whose `options` schema contains a nested array of sub-plugins that itself sits inside another array/object, so the array index appears before the final path key (e.g. `plugins.options.things[0].plugins[0]`).

Common situations: Authoring a plugin that exposes its own `plugins` option structured as arrays-inside-arrays; unusual custom plugin option schemas.

Related errors


AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13). Data as JSON: /api/errors/489def818ad506ab. Report an issue: GitHub.