{"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":null,"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/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts#L256-L292","documentation":"Thrown by validateWebAssemblyComponentPayload (ComponentDescriptorDiscovery.ts:274) when a webassembly/auto marker lacks a truthy 'typeName' field. The typeName is the full type name of the component (e.g. 'MyApp.Components.MyWidget'); without it the WebAssembly host cannot instantiate the component.","triggerScenarios":"A webassembly/auto marker JSON that omits 'typeName'; emitted by a custom serializer or hand-built marker; corrupted/truncated marker.","commonSituations":"Custom marker generation missing the type name; version mismatch; middleware dropping JSON fields; reflective component registration that failed to produce the type name.","solutions":["Confirm the marker JSON has a non-empty 'typeName' (namespace + class).","Emit markers via the framework WebAssembly component registration API.","Match framework versions.","Inspect served HTML to see the actual marker and fix its producer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function hasTypeName(payload: any): boolean {\n  return typeof payload?.typeName === 'string' && payload.typeName.length > 0;\n}","typeGuard":"function isWebAssemblyMarkerData(payload: any): payload is { assembly: string; typeName: string } {\n  return typeof payload?.assembly === 'string' && typeof payload?.typeName === 'string'\n    && payload.assembly.length > 0 && payload.typeName.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Use framework WebAssembly component registration.","Inspect served HTML markers when debugging.","Pin framework versions."],"tags":["blazor","webassembly","markers","serialization","validation"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}