{"record":{"id":"6323b286d6e537c7","repo":"dotnet/aspnetcore","slug":"end-of-component-comment-prerendered-property-must","errorCode":null,"errorMessage":"End of component comment prerendered property must match the start comment prerender id: '${prerenderId}', '${prerenderEndId}'","messagePattern":"End of component comment prerendered property must match the start comment prerender id: '(.+?)', '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts","lineNumber":295,"sourceCode":"  // Parameter definitions and values come Base64 encoded from the server, since they contain random data and can make the\n  // comment invalid. We could unencode them in .NET Code, but that would be slower to do and we can leverage the fact that\n  // JS provides a native function that will be much faster and that we are doing this work while we are fetching\n  // blazor.boot.json\n  payload.parameterDefinitions = payload.parameterDefinitions && atob(payload.parameterDefinitions);\n  payload.parameterValues = payload.parameterValues && atob(payload.parameterValues);\n}\n\nfunction validateEndComponentPayload(json: string, prerenderId: string): void {\n  const payload = JSON.parse(json) as ComponentEndMarker;\n  if (Object.keys(payload).length !== 1) {\n    throw new Error(`Invalid end of component comment: '${json}'`);\n  }\n  const prerenderEndId = payload.prerenderId;\n  if (!prerenderEndId) {\n    throw new Error(`End of component comment must have a value for the prerendered property: '${json}'`);\n  }\n  if (prerenderEndId !== prerenderId) {\n    throw new Error(`End of component comment prerendered property must match the start comment prerender id: '${prerenderId}', '${prerenderEndId}'`);\n  }\n}\n\nclass ComponentCommentIterator {\n  private childNodes: NodeListOf<ChildNode>;\n\n  private currentIndex: number;\n\n  private length: number;\n\n  public currentElement: ChildNode | undefined;\n\n  public constructor(childNodes: NodeListOf<ChildNode>) {\n    this.childNodes = childNodes;\n    this.currentIndex = -1;\n    this.length = childNodes.length;\n  }\n","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts#L277-L313","documentation":"Thrown by validateEndComponentPayload (ComponentDescriptorDiscovery.ts:295) when the end marker's prerenderId does not equal the start marker's prerenderId. Blazor pairs prerendered components by matching these IDs; a mismatch means start and end comments got out of order (e.g. interleaved or duplicated markers).","triggerScenarios":"A start marker's prerenderId differs from the next end marker encountered while iterating; caused by reordered/duplicated prerendered component comments in the DOM.","commonSituations":"HTML reordering by minifiers/transformers; nested prerendered components whose comments got interleaved incorrectly; duplicated cached prerender fragments; version mismatch in prerenderId format.","solutions":["Inspect the raw HTML to verify each start <!--Blazor:{...prerenderId...}--> is immediately followed by its matching <!--Blazor:{prerenderId:'<same id>'}-->.","Disable HTML comment reordering/minification on Blazor pages.","Match framework versions.","Avoid caching prerendered fragments in a way that re-orders markers."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function markersArePaired(startPayload: {prerenderId?:string}, endPayload: {prerenderId?:string}): boolean {\n  return !!startPayload?.prerenderId && startPayload.prerenderId === endPayload?.prerenderId;\n}","typeGuard":"function isMatchingEnd(startId: string, endPayload: any): boolean {\n  return endPayload?.prerenderId === startId;\n}","tryCatchPattern":null,"preventionTips":["Do not reorder HTML comments on Blazor pages.","Avoid caching prerender fragments out of order.","Match framework versions so prerenderId formats agree."],"tags":["blazor","ssr","prerendering","markers","ordering","validation"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}