gatsbyjs/gatsby · error

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

Error message

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

What it means

Thrown by ServerSlice (the SSR Slice renderer) when slicesMap[sliceName] is falsy — meaning the slice alias used in <Slice alias='...' /> has no mapping to a concrete slice component name. Unlike the inline-slice variant (117), this fires at the mapping lookup stage, before any result is fetched, indicating the alias was never registered.

Source

Thrown at packages/gatsby/cache-dir/slice/server-slice.js:29

  const propsString = createContentDigest(sliceProps)
  return `${sliceName}-${propsString}`
}

export const ServerSlice = ({
  sliceName,
  allowEmpty,
  children,
  ...sliceProps
}) => {
  const slicesMap = useContext(SlicesMapContext)
  const slicesProps = useContext(SlicesPropsContext)
  const concreteSliceName = slicesMap[sliceName]

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

  const sliceId = getSliceId(concreteSliceName, sliceProps)

  // set props on context object for static-entry to return
  let sliceUsage = slicesProps[sliceId]
  if (!sliceUsage) {
    slicesProps[sliceId] = sliceUsage = {
      props: sliceProps,
      sliceName: concreteSliceName,
      hasChildren: !!children,
    }
  } else {
    if (children) {
      sliceUsage.hasChildren = true

View on GitHub (pinned to 8b06340921)

Solutions

  1. Verify the alias in <Slice alias='...' /> exactly matches a defineSlice call in gatsby-node.js.
  2. Ensure defineSlice runs unconditionally (not inside a conditional that might be skipped).
  3. Check build output for slice registration — the slice name should appear in the generated slices map.
  4. If the slice is truly optional, pass allowEmpty={true} to suppress the error.

Example fix

// before — alias not registered
// gatsby-node.js defines: defineSlice('header', component)
// but page uses:
<Slice alias="Header" />  // case mismatch

// after — exact alias match
<Slice alias="header" />
Defensive patterns

Strategy: validation

Validate before calling

// Verify slice alias is registered before SSR
import { SlicesMapContext } from './slice/context'

function useRegisteredSliceName(alias) {
  const slicesMap = React.useContext(SlicesMapContext)
  const concrete = slicesMap[alias]
  if (!concrete) {
    console.warn(`Slice alias "${alias}" is not registered in slices map`)
    return null
  }
  return concrete
}

Prevention

When it happens

Trigger: During server-side rendering, an <Slice alias='header' /> is rendered, but slicesMap['header'] returns undefined. This means the slice alias was not registered in the SlicesMapContext, typically because defineSlice was never called for that alias or the alias string has a typo.

Common situations: Typo in the alias prop, a slice defined in one Gatsby environment but not another, the slice registration in gatsby-node.js is conditional and didn't execute, or the SlicesMapContext wasn't populated due to a build error.

Related errors


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