gatsbyjs/gatsby · error

Skipping TableOfContents. Field '${appliedTocOptions.pathToS

Error message

Skipping TableOfContents. Field '${appliedTocOptions.pathToSlugField}' missing from markdown node

What it means

Guard while building the tableOfContents HTML: for a markdown link node with a url, the field named by appliedTocOptions.pathToSlugField (default 'slug') is undefined on the node being linked, so a URL to embed cannot be formed. That link is skipped (kept as-is) and the rest of the ToC is generated.

Source

Thrown at packages/gatsby-transformer-remark/src/extend-node-type.js:398

      }

      const ast = await getAST(markdownNode, context)
      const headings = selectAll(`heading`, ast).map(heading => {
        return {
          id: getHeadingID(heading),
          value: mdastToString(heading),
          depth: heading.depth,
        }
      })

      await cache.set(markdownCacheKey, headings)
      return headings
    }

    function addSlugToUrl(markdownNode, slugField, appliedTocOptions, node) {
      if (node.url) {
        if (slugField === undefined) {
          console.warn(
            `Skipping TableOfContents. Field '${appliedTocOptions.pathToSlugField}' missing from markdown node`
          )
          return null
        }

        node.url = [basePath, slugField, node.url]
          .join(`/`)
          .replace(/\/\//g, `/`)
      }

      if (node.children) {
        node.children = node.children
          .map(node =>
            addSlugToUrl(markdownNode, slugField, appliedTocOptions, node)
          )
          .filter(Boolean)
      }

View on GitHub (pinned to e85d62f177)

Solutions

  1. Set pathToSlugField in the tableOfContents options to a field that actually exists on the linked nodes
  2. Add the missing field (e.g. slug via gatsby-node onCreateNode) to the node type being linked
  3. Ensure the markdown internal links point to nodes your site actually creates (not absolute external URLs misinterpreted as relative links)
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/gatsby-transformer-remark/src/extend-node-type.js:398 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/2bfe4c08a7b4a8ea. Report an issue: GitHub.