gatsbyjs/gatsby · error

Could not find function loadNodeContent for plugin ${plugin.

Error message

Could not find function loadNodeContent for plugin ${plugin.name}

What it means

The owner plugin was found, but its main module does not export a loadNodeContent function. Plugins that own nodes needing content loading must implement this export so Gatsby can fetch raw content on demand.

Source

Thrown at packages/gatsby/src/utils/nodes.ts:60

  if (typeof node.internal.content === `string`) {
    return node.internal.content
  }

  // Load plugin's loader function
  const plugin = store
    .getState()
    .flattenedPlugins.find(plug => plug.name === node.internal.owner)

  if (!plugin) {
    throw new Error(
      `Could not find owner plugin of node for loadNodeContent with owner \`${node.internal.owner}\``
    )
  }

  const { loadNodeContent } = require(plugin.resolve)

  if (!loadNodeContent) {
    throw new Error(
      `Could not find function loadNodeContent for plugin ${plugin.name}`
    )
  }

  const content = await loadNodeContent(node)

  node.internal.content = content

  return content
}

View on GitHub (pinned to 8b06340921)

Solutions

  1. Implement and export loadNodeContent in the owning plugin's gatsby-node.js.
  2. Upgrade the plugin to a version that ships loadNodeContent.
  3. Set node.internal.content directly at createNode time to bypass lazy loading.

Example fix

// before: plugin creates nodes but exports no loader -> [177]
exports.sourceNodes = ({ actions }) => { actions.createNode({ ...node, internal: { owner: 'my-plugin' } }) }
// after: export loadNodeContent
easync function loadNodeContent(node) { return fs.readFile(node.absolutePath, 'utf8') }
exports.loadNodeContent = loadNodeContent
Defensive patterns

Strategy: validation

Validate before calling

function pluginExportsLoadNodeContent(plugin) {
  const mod = require(plugin.resolve)
  return typeof mod.loadNodeContent === 'function'
}

Type guard

function hasLoadNodeContent(mod) { return typeof mod?.loadNodeContent === 'function' }

Prevention

When it happens

Trigger: A plugin calls createNode for nodes that later require content loading, but the plugin's gatsby-node.js does not export loadNodeContent.

Common situations: Source plugin using createNode but forgetting loadNodeContent; a plugin version that dropped the export; transformer plugin expecting the source plugin to provide it.

Related errors


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