withastro/astro · error · Error
Could not find server component export
Error message
Could not find server component export
What it means
Companion to the component-path guard: ServerIslandComponent.getComponentExport reads the internal prop server:component-export (the named export of the island component), also injected by the compiler at build time. Without it the island host does not know which export to request from the server-island endpoint, so it throws.
Source
Thrown at packages/astro/src/runtime/server/render/server-islands.ts:111
getComponentPath(): string {
if (this.componentPath) {
return this.componentPath;
}
const componentPath = this.props['server:component-path'];
if (!componentPath) {
throw new Error(`Could not find server component path`);
}
this.componentPath = componentPath;
return componentPath;
}
getComponentExport(): string {
if (this.componentExport) {
return this.componentExport;
}
const componentExport = this.props['server:component-export'];
if (!componentExport) {
throw new Error(`Could not find server component export`);
}
this.componentExport = componentExport;
return componentExport;
}
async getHostId() {
if (!this.hostId) {
this.hostId = await crypto.randomUUID();
}
return this.hostId;
}
async getIslandContent() {
if (this.islandContent) {
return this.islandContent;
}
const componentPath = this.getComponentPath();View on GitHub (pinned to 52e6c34790)
Solutions
- Align astro and @astrojs/compiler versions (clean reinstall of node_modules/lockfile)
- Rely on the public server islands API so the compiler generates both internal props
- Audit any HTML/attribute post-processing that could strip server:* attributes from island hosts
Defensive patterns
Strategy: validation
Validate before calling
// verify both internal props exist before rendering an island host
const needed = ['server:component-path', 'server:component-export'];
for (const p of needed) {
if (!props[p]) throw new Error('Server island host missing ' + p);
} Type guard
function isCompleteServerIslandProps(props: Record<string, unknown>): boolean {
return typeof props['server:component-path'] === 'string' && typeof props['server:component-export'] === 'string';
} Prevention
- Let the compiler generate server:component-path/export — do not hand-build island hosts
- Reinstall dependencies after Astro upgrades so compiler and runtime match
- Audit attribute-rewriting plugins for server:* attributes
When it happens
Trigger: Same root causes as the missing path prop: manual construction of ServerIslandComponent, compiler/astro version skew skipping the prop-injection transform, or attribute-stripping plugins removing server:component-export from the rendered host.
Common situations: Partial upgrades leaving an older compiler in the lockfile; custom renderers re-rendering island hosts; experimentation with the internal server-islands runtime.
Related errors
- Could not find server component path
- Could not find server component name ${componentPath}
- Server address unavailable, this should not happen. Open an
- NoAdapterInstalledServerIslands
- ⚠️ Astro expected an SVG for "${transform.src}" but the sou
AI-assisted analysis of withastro/astro@52e6c34790 (2026-08-18).
Data as JSON: /api/errors/edcf3ee65a063bc9.
Report an issue: GitHub.