dotnet/aspnetcore · error · Error
Could not find an end component comment for
Error message
Could not find an end component comment for '${start}'. What it means
Thrown by getComponentEndComment after walking siblings of the start comment and finding no matching end comment for the given prerenderId. Prerendered components are bracketed by a start comment and an end comment carrying the same prerenderId; if the iterator exhausts siblings without the closing marker, the DOM is considered broken and discovery fails.
Solutions
- Inspect the served HTML: confirm both start and end Blazor comments are present and carry the same prerenderId.
- Disable any HTML post-processing that strips comments between prerender start and end.
- Ensure the full prerendered response is flushed (no truncation).
- Re-check that the component tree is balanced (no conditional that opens a marker without closing it).
- Align server and client runtime versions.
Defensive patterns
Strategy: validation
Validate before calling
function assertPairedMarkers(html: string) {
const starts = (html.match(/<!--Blazor:[^{]*{"type"/g) || []).length;
// end comments carry prerenderId only
if (starts === 0) return;
// ensure each start has a matching end by prerenderId (simplified)
} Prevention
- Ensure prerender output flushes both start and end comments.
- Disable HTML transforms that strip comments.
- Keep component boundaries balanced in layouts.
- Verify full HTML in DevTools source view.
When it happens
Trigger: The <!--Blazor:{...prerenderId...}--> start marker exists but its matching end comment was removed, reordered, or never emitted; an HTML transformation split the component region; streaming SSR truncated before the end comment.
Common situations: HTML minifier/post-processor that drops 'redundant' comments; a partial render that emitted only the opening marker; a layout that conditionally renders and cuts the component boundary; caching that captured only part of the prerendered output.
Related errors
- Found malformed component comment at
- Invalid end of component comment
- Root components cannot be marked as interactive. The
- assembly must be defined when using a descriptor.
- descriptor must be defined when using a descriptor.
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/ea5f2c7cd61c3266.
Report an issue: GitHub.
Appendix: source
Thrown at src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts:211
if (node.nodeType !== Node.COMMENT_NODE) {
continue;
}
if (!node.textContent) {
continue;
}
const definition = blazorCommentRegularExpression.exec(node.textContent);
const json = definition && definition[1];
if (!json) {
continue;
}
validateEndComponentPayload(json, prerenderId);
return node as Comment;
}
throw new Error(`Could not find an end component comment for '${start}'.`);
}
let nextUniqueDescriptorId = 0;
function createServerComponentComment(payload: ServerComponentMarker, start: Comment, end: Comment | undefined): ServerComponentDescriptor {
validateServerComponentPayload(payload);
return {
...payload,
uniqueId: nextUniqueDescriptorId++,
start,
end,
};
}
function createWebAssemblyComponentComment(payload: WebAssemblyComponentMarker, start: Comment, end: Comment | undefined): WebAssemblyComponentDescriptor {
validateWebAssemblyComponentPayload(payload);
View on GitHub (pinned to 3600ca084e)