dotnet/aspnetcore · error

Error parsing the sequence '${sequence}' for component '${JS

Error message

Error parsing the sequence '${sequence}' for component '${JSON.stringify(payload)}'

What it means

Thrown by validateServerComponentPayload (ComponentDescriptorDiscovery.ts:262) when 'sequence' is present but not an integer (Number.isInteger fails — e.g. a float, a string, NaN, Infinity). The marker JSON and full payload are echoed for diagnosis.

Source

Thrown at src/Components/Web.JS/src/Services/ComponentDescriptorDiscovery.ts:262

    uniqueId: nextUniqueDescriptorId++,
    start,
    end,
  };
}

function validateServerComponentPayload(payload: ServerMarkerData) {
  const { descriptor, sequence } = payload;

  if (!descriptor) {
    throw new Error('descriptor must be defined when using a descriptor.');
  }

  if (sequence === undefined) {
    throw new Error('sequence must be defined when using a descriptor.');
  }

  if (!Number.isInteger(sequence)) {
    throw new Error(`Error parsing the sequence '${sequence}' for component '${JSON.stringify(payload)}'`);
  }
}

function validateWebAssemblyComponentPayload(payload: WebAssemblyMarkerData) {
  const { assembly, typeName } = payload;

  if (!assembly) {
    throw new Error('assembly must be defined when using a descriptor.');
  }

  if (!typeName) {
    throw new Error('typeName must be defined when using a descriptor.');
  }

  // Parameter definitions and values come Base64 encoded from the server, since they contain random data and can make the
  // comment invalid. We could unencode them in .NET Code, but that would be slower to do and we can leverage the fact that
  // JS provides a native function that will be much faster and that we are doing this work while we are fetching
  // blazor.boot.json

View on GitHub (pinned to 294cab2f9b)

Solutions

  1. Ensure sequence is emitted as a JSON integer literal (no quotes, no fractional part).
  2. Use the framework's marker generation rather than a custom serializer.
  3. Align framework versions between server and client.
  4. Inspect the echoed payload in the error to see the exact bad value and trace where it was produced.
Defensive patterns

Strategy: type-guard

Validate before calling

function isIntegerSequence(payload: any): boolean {
  return payload && Number.isInteger(payload.sequence);
}

Type guard

function hasValidSequence(payload: any): payload is { sequence: number } {
  return Number.isInteger(payload?.sequence);
}

Prevention

When it happens

Trigger: Marker with sequence: 1.5, sequence: "1" (string), or sequence: null after JSON.parse; typically a serialization bug producing a non-integer or wrong type.

Common situations: Custom marker emitter passing a float or string; JSON produced with a converter that changes number formatting; framework version mismatch where sequence type changed; tampered/corrupted marker.

Related errors


AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06). Data as JSON: /api/errors/44c73b2e029cc7f9. Report an issue: GitHub.