dotnet/aspnetcore · error
End of component comment must have a value for the prerender
Error message
End of component comment must have a value for the prerendered property: '${json}' What it means
Thrown by validateEndComponentPayload (ComponentDescriptorDiscovery.ts:292) when an end marker JSON has exactly one key but that key is not 'prerenderId' (or prerenderId is falsy). The end marker must carry the prerenderId to pair with its start marker.
Source
Thrown at src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts:292
throw new Error('typeName must be defined when using a descriptor.');
}
// Parameter definitions and values come Base64 encoded from the server, since they contain random data and can make the
// comment invalid. We could unencode them in .NET Code, but that would be slower to do and we can leverage the fact that
// JS provides a native function that will be much faster and that we are doing this work while we are fetching
// blazor.boot.json
payload.parameterDefinitions = payload.parameterDefinitions && atob(payload.parameterDefinitions);
payload.parameterValues = payload.parameterValues && atob(payload.parameterValues);
}
function validateEndComponentPayload(json: string, prerenderId: string): void {
const payload = JSON.parse(json) as ComponentEndMarker;
if (Object.keys(payload).length !== 1) {
throw new Error(`Invalid end of component comment: '${json}'`);
}
const prerenderEndId = payload.prerenderId;
if (!prerenderEndId) {
throw new Error(`End of component comment must have a value for the prerendered property: '${json}'`);
}
if (prerenderEndId !== prerenderId) {
throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${prerenderId}', '${prerenderEndId}'`);
}
}
class ComponentCommentIterator {
private childNodes: NodeListOf<ChildNode>;
private currentIndex: number;
private length: number;
public currentElement: ChildNode | undefined;
public constructor(childNodes: NodeListOf<ChildNode>) {
this.childNodes = childNodes;
this.currentIndex = -1;View on GitHub (pinned to 294cab2f9b)
Solutions
- Confirm the end comment JSON key is exactly 'prerenderId' with a non-empty value.
- Use framework marker generation; match versions.
- Inspect raw HTML end comment.
Defensive patterns
Strategy: validation
Validate before calling
function endMarkerHasPrerenderId(json: string): boolean {
try {
const p = JSON.parse(json);
return !!p?.prerenderId;
} catch { return false; }
} Type guard
function hasPrerenderId(payload: any): payload is { prerenderId: string } {
return typeof payload?.prerenderId === 'string' && payload.prerenderId.length > 0;
} Prevention
- Emit end markers with exactly the prerenderId key.
- Use framework marker generation; pin versions.
- Inspect raw HTML end comments.
When it happens
Trigger: End comment JSON like {"foo":"bar"} — single key but wrong name; or {"prerenderId":null} / empty string.
Common situations: Custom end-marker emission with a wrong key name; version mismatch; JSON rewrite that renamed the field.
Related errors
- Invalid end of component comment: '${json}'
- End of component comment prerendered property must match the
- Could not find an end component comment for '${start}'.
- Found malformed component comment at ${candidateStart.textCo
- Invalid component type '${type}'.
AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06).
Data as JSON: /api/errors/345cd9cce2fb78b4.
Report an issue: GitHub.