{"record":{"id":"37c6caee045416e5","repo":"dotnet/aspnetcore","slug":"typename-must-be-defined-when-using-a-descriptor","errorCode":null,"errorMessage":"typeName must be defined when using a descriptor.","messagePattern":"typeName 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":274,"sourceCode":"\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\n  if (!typeName) {\n    throw new Error('typeName must be defined when using a descriptor.');\n  }\n\n  // 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}'`);","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts#L256-L292","documentation":"Thrown by validateWebAssemblyComponentPayload when the typeName field is missing on a webassembly component marker. Along with assembly, typeName identifies the exact component type to instantiate; without it the runtime cannot resolve the component. This is the second required field check for webassembly markers after assembly.","triggerScenarios":"A webassembly component comment JSON with no 'typeName' key; the field stripped by a transform; a custom emitter that forgot the fully-qualified type name.","commonSituations":"HTML post-processing that drops fields; version mismatch changing the schema; hand-crafted markers; a refactor that renamed the component type but the cached/old marker is still served.","solutions":["Confirm the served comment JSON includes the fully-qualified 'typeName' (e.g. 'MyApp.Components.MyWidget').","Disable HTML transforms that modify Blazor comment JSON.","Clear output caches so stale markers are regenerated.","Ensure server and client Blazor versions match."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function assertWasmTypeName(payload: any) {\n  if (!payload?.typeName) {\n    throw new Error('WebAssembly component marker is missing typeName.');\n  }\n}","typeGuard":"function hasTypeName(p: any): p is { typeName: string } {\n  return typeof p?.typeName === 'string' && p.typeName.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Include the fully-qualified type name in the marker.","Don't post-process Blazor comment JSON.","Clear stale output caches after renaming components."],"tags":["blazor","prerendering","markers","webassembly","validation"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}