{"record":{"id":"6e15acda473d9731","repo":"withastro/astro","slug":"unable-to-render-result-pathname-because-it-con","errorCode":null,"errorMessage":"Unable to render ${result.pathname} because it contains an undefined Component!\nDid you forget to import the component or is it possible there is a typo?","messagePattern":"Unable to render (.+?) because it contains an undefined Component!\nDid you forget to import the component or is it possible there is a typo\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/astro/src/runtime/server/jsx.ts","lineNumber":68,"sourceCode":"\t\t\t\t\tcontent += item;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (instructions) {\n\t\t\t\treturn markHTMLString(new SlotString(content, instructions));\n\t\t\t}\n\t\t\treturn markHTMLString(content);\n\t\t}\n\t}\n\n\treturn renderJSXVNode(result, vnode);\n}\n\nasync function renderJSXVNode(result: SSRResult, vnode: AstroVNode): Promise<any> {\n\tif (isVNode(vnode)) {\n\t\t// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n\t\tswitch (true) {\n\t\t\tcase !vnode.type: {\n\t\t\t\tthrow new Error(`Unable to render ${result.pathname} because it contains an undefined Component!\nDid you forget to import the component or is it possible there is a typo?`);\n\t\t\t}\n\t\t\tcase (vnode.type as any) === Symbol.for('astro:fragment'):\n\t\t\t\treturn renderJSX(result, vnode.props.children);\n\t\t\tcase isAstroComponentFactory(vnode.type): {\n\t\t\t\tlet props: Record<string, any> = {};\n\t\t\t\tlet slots: Record<string, any> = {};\n\t\t\t\tfor (const [key, value] of Object.entries(vnode.props ?? {})) {\n\t\t\t\t\tif (key === 'children' || (value && typeof value === 'object' && value['$$slot'])) {\n\t\t\t\t\t\tslots[key === 'children' ? 'default' : key] = () => renderJSX(result, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprops[key] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// We don't use renderToString because it doesn't contain the server island script handling\n\t\t\t\tconst str = await renderComponentToString(\n\t\t\t\t\tresult,\n\t\t\t\t\tvnode.type.name,","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/runtime/server/jsx.ts#L50-L86","documentation":"In the legacy/non-streaming JSX renderer (`renderJSXVNode`), a VNode reached render with a falsy `type`. A VNode's `type` is the component function/class/string-tag; a falsy one means the component reference itself is `undefined`. Astro cannot render an unknown element, so it throws. The message names the current `result.pathname` to help locate the page.","triggerScenarios":"Using an undefined variable as a JSX tag (`<{MaybeMissing} />`); a component variable that resolved to `undefined` due to a failed/conditional import; an object property access that returned undefined then used as a tag; a typo in the component identifier.","commonSituations":"Forgot to `import` the component; conditional/dynamic component selection where none matched and defaulted to undefined; named import that doesn't exist in the module; refactoring that renamed a component without updating usages.","solutions":["Import the component with the correct name at the top of the file.","Verify the identifier matches the export (default vs named) and isn't shadowed/undefined at the call site.","Guard dynamic component selection with a fallback so the tag is always defined."],"exampleFix":"// before\n// (Component never imported)\n<Component />   // Component is undefined\n\n// after\nimport Component from '../components/Component.astro';\n<Component />","handlingStrategy":"type-guard","validationCode":"function assertDefinedComponent(Comp: unknown, name: string): void {\n  if (!Comp) {\n    throw new Error(`Component '${name}' is undefined; check the import.`);\n  }\n}","typeGuard":"const isComponent = (v: unknown): v is Function | string =>\n  typeof v === 'function' || typeof v === 'string';\n\n// Dynamic JSX guard:\nconst Tag = isComponent(Maybe) ? Maybe : 'div';","tryCatchPattern":null,"preventionTips":["Always import components explicitly at the top of the file.","For dynamic tags, default to a Fragment or placeholder when the lookup misses.","Enable strict TypeScript so undefined identifiers fail to compile."],"tags":["jsx","undefined-component","render","astro-component"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}