{"record":{"id":"8ccc4cc848776b16","repo":"withastro/astro","slug":"the-renderer-name-must-be-provided-when-adding-a-s","errorCode":null,"errorMessage":"The renderer name must be provided when adding a server renderer that is not a named renderer.","messagePattern":"The renderer name must be provided when adding a server renderer that is not a named renderer\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/astro/src/container/index.ts","lineNumber":391,"sourceCode":"\t\tconst { renderer } = options;\n\t\tif (!renderer.check || !renderer.renderToStaticMarkup) {\n\t\t\tthrow new Error(\n\t\t\t\t\"The renderer you passed isn't valid. A renderer is usually an object that exposes the `check` and `renderToStaticMarkup` functions.\\n\" +\n\t\t\t\t\t\"Usually, the renderer is exported by a /server.js entrypoint e.g. `import renderer from '@astrojs/react/server.js'`\",\n\t\t\t);\n\t\t}\n\t\tif (isNamedRenderer(renderer)) {\n\t\t\tthis.#pipeline.manifest.renderers.push({\n\t\t\t\tname: renderer.name,\n\t\t\t\tssr: renderer,\n\t\t\t});\n\t\t} else if ('name' in options) {\n\t\t\tthis.#pipeline.manifest.renderers.push({\n\t\t\t\tname: options.name,\n\t\t\t\tssr: renderer,\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t'The renderer name must be provided when adding a server renderer that is not a named renderer.',\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Use this function to manually add a **client** renderer to the container.\n\t *\n\t * When rendering components that use the `client:*` directives, you need to use this function.\n\t *\n\t * ## Example\n\t *\n\t * ```js\n\t * import reactRenderer from \"@astrojs/react/server.js\";\n\t * import { experimental_AstroContainer as AstroContainer } from \"astro/container\"\n\t *\n\t * const container = await AstroContainer.create();\n\t * container.addServerRenderer(reactRenderer);","sourceCodeStart":373,"sourceCodeEnd":409,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/container/index.ts#L373-L409","documentation":"`addServerRenderer` accepts either a named renderer (an object with its own `name` property) or a `(name, renderer)`/`{name, renderer}` pair. If the renderer is not named AND no `name` was supplied in options, the container cannot register it because the manifest requires a `name` to match against integration/client renderers.","triggerScenarios":"Calling `container.addServerRenderer({ renderer: customRenderer })` where `customRenderer` has no `name` property and no `name` option is passed.","commonSituations":"Writing a custom renderer and forgetting to add a `name`; destructuring only `{ check, renderToStaticMarkup }` from an existing renderer and passing the partial; assuming the container will infer a name from the file path.","solutions":["Pass an explicit name: `container.addServerRenderer({ name: 'my-renderer', renderer: customRenderer })`.","Or give the renderer object a `name` property so `isNamedRenderer` matches.","Use the `name` that matches the integration package name so `addClientRenderer` can find it later."],"exampleFix":"// before\ncontainer.addServerRenderer({ renderer: customRenderer });\n// after\ncontainer.addServerRenderer({ name: 'my-renderer', renderer: customRenderer });","handlingStrategy":"validation","validationCode":"const name = renderer.name ?? options.name;\nif (!name) throw new Error('Pass a name for unnamed server renderers.');","typeGuard":"function hasRendererName(renderer, options): renderer is { name: string } | { name: string } {\n  return typeof renderer?.name === 'string' || typeof options?.name === 'string';\n}","tryCatchPattern":null,"preventionTips":["Always pass `{ name, renderer }` for custom renderers.","Give the renderer object a `name` property to satisfy `isNamedRenderer`.","Use the integration's package name as the renderer name."],"tags":["container","ssr","renderer","validation"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}