{"record":{"id":"af9fe5ce8242c108","repo":"dotnet/aspnetcore","slug":"descriptor-must-be-defined-when-using-a-descriptor","errorCode":null,"errorMessage":"descriptor must be defined when using a descriptor.","messagePattern":"descriptor must be defined when using a descriptor\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts","lineNumber":254,"sourceCode":"}\n\nfunction createAutoComponentComment(payload: AutoComponentMarker, start: Comment, end: Comment | undefined): AutoComponentDescriptor {\n  validateServerComponentPayload(payload);\n  validateWebAssemblyComponentPayload(payload);\n\n  return {\n    ...payload,\n    uniqueId: nextUniqueDescriptorId++,\n    start,\n    end,\n  };\n}\n\nfunction validateServerComponentPayload(payload: ServerMarkerData) {\n  const { descriptor, sequence } = payload;\n\n  if (!descriptor) {\n    throw new Error('descriptor must be defined when using a descriptor.');\n  }\n\n  if (sequence === undefined) {\n    throw new Error('sequence must be defined when using a descriptor.');\n  }\n\n  if (!Number.isInteger(sequence)) {\n    throw new Error(`Error parsing the sequence '${sequence}' for component '${JSON.stringify(payload)}'`);\n  }\n}\n\nfunction validateWebAssemblyComponentPayload(payload: WebAssemblyMarkerData) {\n  const { assembly, typeName } = payload;\n\n  if (!assembly) {\n    throw new Error('assembly must be defined when using a descriptor.');\n  }\n","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts#L236-L272","documentation":"Thrown by validateServerComponentPayload when the descriptor field is missing on a server component marker. Server components require a descriptor (the encrypted/signed component identifier) to map the marker to a .NET component instance. Without it the framework cannot hydrate the component.","triggerScenarios":"A <!--Blazor:{type:server,...}--> comment where the JSON object has no 'descriptor' key; the descriptor was stripped or renamed by a transform.","commonSituations":"HTML minification/serialization that drops empty or specific fields; a corrupt prerender output; a custom marker emitter that forgot the descriptor; version skew between the server emitting and client consuming the marker.","solutions":["Verify the served HTML comment JSON contains a non-empty 'descriptor' field.","Remove any HTML post-processing that alters Blazor comment JSON.","Ensure the .NET prerendering pipeline is the one emitting markers (don't hand-roll them).","Update server and client Blazor packages to matching versions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function assertServerMarker(payload: any) {\n  if (!payload?.descriptor) {\n    throw new Error('Server component marker is missing descriptor.');\n  }\n}","typeGuard":"function hasDescriptor(p: any): p is { descriptor: string } {\n  return typeof p?.descriptor === 'string' && p.descriptor.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Don't post-process Blazor comment JSON.","Use the official prerendering pipeline to emit markers.","Align server and client versions."],"tags":["blazor","prerendering","markers","server","validation"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}