gatsbyjs/gatsby · error

Slice "${concreteSliceName}" for "${sliceName}" slot not fou

Error message

Slice "${concreteSliceName}" for "${sliceName}" slot not found

What it means

Thrown by InlineSlice (the browser/dev-ssr Slice renderer) when the concrete slice name resolved from slicesMap does not have a corresponding entry in slicesResultsMap. The Slice alias is mapped to a concrete component name, and the results map should contain the compiled slice with its component and data. If the result is missing and allowEmpty is false, the error fires.

Source

Thrown at packages/gatsby/cache-dir/slice/inline-slice.js:19

import React, { useContext } from "react"
import { SlicesMapContext, SlicesResultsContext } from "./context"

export const InlineSlice = ({
  sliceName,
  allowEmpty,
  children,
  ...sliceProps
}) => {
  const slicesMap = useContext(SlicesMapContext)
  const slicesResultsMap = useContext(SlicesResultsContext)
  const concreteSliceName = slicesMap[sliceName]
  const slice = slicesResultsMap.get(concreteSliceName)

  if (!slice) {
    if (allowEmpty) {
      return null
    } else {
      throw new Error(
        `Slice "${concreteSliceName}" for "${sliceName}" slot not found`
      )
    }
  }

  return (
    <slice.component
      sliceContext={slice.sliceContext}
      data={slice.data}
      {...sliceProps}
    >
      {children}
    </slice.component>
  )
}

View on GitHub (pinned to 8b06340921)

Solutions

  1. Verify the slice alias in <Slice alias='...' /> matches the alias defined in gatsby-node.js.
  2. Check build logs for errors on the slice's component file — a build error means no result is generated.
  3. Run `gatsby clean` and rebuild to regenerate slice results.
  4. If the slice is optional, pass allowEmpty={true} to render null instead of throwing.

Example fix

// before — slice alias mismatch or missing slice
<Slice alias="site-header" />
// but gatsby-node.js defines: defineSlice('header', ...)

// after — match the alias exactly
<Slice alias="header" />

// or, if the slice is optional:
<Slice alias="header" allowEmpty={true} />
Defensive patterns

Strategy: validation

Validate before calling

// Verify slice results exist before rendering
import { SlicesResultsContext } from './slice/context'

function useSliceResult(sliceName) {
  const resultsMap = React.useContext(SlicesResultsContext)
  const slice = resultsMap.get(sliceName)
  if (!slice) {
    console.warn(`Slice "${sliceName}" not found in results map`)
    return null
  }
  return slice
}

Prevention

When it happens

Trigger: An <Slice alias='header' /> renders in the browser. slicesMap['header'] resolves to a concrete name, but slicesResultsMap.get(concreteSliceName) returns undefined — meaning the slice data/component was not collected or passed into the results context. This happens when the slice was registered but not built, or the results context is incomplete.

Common situations: A Slice was defined in gatsby-node.js but the component file errored during build (so no result was generated), a slice alias mismatch between define and usage, the SlicesResultsContext provider was not set up correctly, or a partial hydration boundary excluded the slice's data.

Related errors


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