dotnet/aspnetcore · error · Error

Error parsing the sequence

Error message

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

What it means

Thrown by validateServerComponentPayload when sequence is present but not an integer (Number.isInteger returns false). The sequence must be a whole number to represent deterministic render order; floats, NaN, strings, or other types are rejected. The message echoes both the bad value and the full payload JSON for diagnosis.

Solutions

  1. Ensure the sequence value is emitted as a JSON number (unquoted integer).
  2. Stop any post-processing that coerces marker JSON types.
  3. Regenerate markers from the official prerendering pipeline.
  4. Align server and client versions.
Defensive patterns

Strategy: type-guard

Validate before calling

function assertIntegerSequence(payload: any) {
  if (!Number.isInteger(payload?.sequence)) {
    throw new Error(`sequence must be an integer, got ${payload?.sequence}`);
  }
}

Type guard

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

Prevention

When it happens

Trigger: A server component marker where 'sequence' is a string like "1", a float, null (typeof null is object), or NaN; a transform that converted numbers to strings.

Common situations: JSON re-serialization that turned the integer into a string; a CMS or template engine that coerces numbers; hand-crafted markers with quoted numbers.

Related errors


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

Appendix: 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 3600ca084e)