{"record":{"id":"d37b31bcfb9ee14c","repo":"gatsbyjs/gatsby","slug":"slice-context-slicescontext-renderenvironment","errorCode":null,"errorMessage":"Slice context \"${slicesContext.renderEnvironment}\" is not supported.","messagePattern":"Slice context \"(.+?)\" is not supported\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/cache-dir/slice.js","lineNumber":59,"sourceCode":"      return <InlineSlice {...internalProps} />\n    } else if (slicesContext.renderEnvironment === `slices`) {\n      // we are not yet supporting nested slices\n\n      let additionalContextMessage = ``\n\n      // just in case generating additional contextual information fails, we still want the base message to show\n      // and not show another cryptic error message\n      try {\n        additionalContextMessage = `\\n\\nSlice component \"${slicesContext.sliceRoot.name}\" (${slicesContext.sliceRoot.componentPath}) tried to render <Slice alias=\"${props.alias}\"/>`\n      } catch {\n        // don't need to handle it, we will just skip the additional context message if we fail to generate it\n      }\n\n      throw new Error(\n        `Nested slices are not supported.${additionalContextMessage}\\n\\nSee https://gatsbyjs.com/docs/reference/built-in-components/gatsby-slice#nested-slices`\n      )\n    } else {\n      throw new Error(\n        `Slice context \"${slicesContext.renderEnvironment}\" is not supported.`\n      )\n    }\n  } else {\n    throw new Error(`Slices are disabled.`)\n  }\n}\n\nclass SlicePropsError extends Error {\n  constructor(inBrowser, sliceName, propErrors, renderedByLocation) {\n    const errors = Object.entries(propErrors)\n      .map(\n        ([key, value]) =>\n          `not serializable \"${value}\" type passed to \"${key}\" prop`\n      )\n      .join(`, `)\n\n    const name = `SlicePropsError`","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/cache-dir/slice.js#L41-L77","documentation":"Thrown when the <Slice> component receives a SlicesContext whose renderEnvironment is an unrecognized value — not 'server', 'browser', 'engines', 'dev-ssr', or 'slices'. This means the Slice is being rendered in a context that Gatsby does not know how to handle, indicating an internal misconfiguration or an unsupported rendering pipeline.","triggerScenarios":"The SlicesContext.renderEnvironment is set to an unexpected string (or undefined/null due to a missing provider). The Slice component's conditional chain falls through to the else branch and throws. This typically indicates a Gatsby internal issue or a custom SSR setup that provides a SlicesContext with a wrong value.","commonSituations":"A Gatsby version mismatch between the cache-dir Slice component and the SSR/static-entry that sets the context, a custom SSR renderer that wraps Slice rendering without setting renderEnvironment correctly, or an experimental Gatsby feature that introduced a new environment without updating the Slice handler.","solutions":["Ensure all Gatsby packages are at the same version: `npm ls gatsby` and update mismatches.","Run `gatsby clean` and rebuild to eliminate stale cache-dir code.","If using a custom SSR setup, verify SlicesContext is provided with a valid renderEnvironment ('server', 'browser', 'engines', or 'dev-ssr').","Report as a Gatsby bug if using standard configuration — include the renderEnvironment value from the error message."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate renderEnvironment before rendering Slices in custom SSR\nconst VALID_ENVS = ['server', 'browser', 'engines', 'dev-ssr']\n\nfunction isValidRenderEnv(env) {\n  return VALID_ENVS.includes(env)\n}\n\nif (!isValidRenderEnv(slicesContext.renderEnvironment)) {\n  console.error(`Unknown Slice render environment: ${slicesContext.renderEnvironment}`)\n}","typeGuard":"type SliceRenderEnvironment = 'server' | 'browser' | 'engines' | 'dev-ssr'\n\nfunction isSliceRenderEnv(env: string): env is SliceRenderEnvironment {\n  return ['server', 'browser', 'engines', 'dev-ssr'].includes(env)\n}","tryCatchPattern":null,"preventionTips":["Keep all @gatsby packages version-aligned to avoid context mismatches.","Run `gatsby clean` after upgrading Gatsby.","If building a custom SSR pipeline, ensure SlicesContext.renderEnvironment is one of the known values.","Report unexpected renderEnvironment values as Gatsby bugs with full version info."],"tags":["slices","context","internal","ssr","render-environment"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}