dotnet/aspnetcore · error · Error
Invalid sequence number or identifier
Error message
Invalid sequence number or identifier '${sequenceOrIdentifier}'. What it means
`resolveElement` maps a `sequenceOrIdentifier` (sent by the server when attaching a root component) to a logical element. It first checks JS-added pending containers, then tries to parse it as a numeric sequence for a .NET-added root component. If neither lookup succeeds the identifier is unresolvable, so it throws to prevent attaching a component to nothing.
Solutions
- Ensure client and server share the same Blazor build so root-component descriptors/sequences agree.
- When adding root components from JS, register the container (`addRootComponent`) before the server-side attach can fire, and avoid removing it prematurely.
- Review the order of `UpdateRootComponents`/`AddRootComponent` operations to confirm the identifier is valid at attach time.
- Capture the offending identifier from the message and correlate with server-side root component registration logs.
Defensive patterns
Strategy: validation
Validate before calling
// before attaching, confirm the identifier is resolvable
function canResolve(seq: string, mgr: RootComponentManager<any>): boolean {
return getAndRemovePendingRootComponentContainer(seq) !== undefined
|| !Number.isNaN(Number.parseInt(seq));
} Try / catch
try { return cm.resolveElement(sequenceOrIdentifier); }
catch (e) { if (/Invalid sequence/.test(e.message)) { /* drop the attach op, log */ return null; } throw e; } Prevention
- Keep client and server Blazor builds identical.
- Register JS-added root containers before the server attach fires.
- Avoid removing pending containers prematurely.
- Sequence UpdateRootComponents operations deterministically.
When it happens
Trigger: The server sends a root-component attach message whose `sequenceOrIdentifier` is neither a pending JS-added container key nor a parseable numeric sequence that `RootComponentManager.resolveRootComponent` can resolve.
Common situations: Mismatched client/server versions where the server registers a root component descriptor the client doesn't have; JS-added root components whose container was already consumed/removed before the attach message arrived; desync in root-component registration during hot reload or render-mode changes; corrupted/out-of-order add-root-component operations.
Related errors
- The circuit associated with this dispatcher is no longer…
- Cannot start a disposed circuit.
- Cannot start the circuit until Blazor Server has started.
- Circuit host not initialized.
- Circuit state is already in progress
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/43ab4411e957377c.
Report an issue: GitHub.
Appendix: source
Thrown at src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts:559
this.changeActivity(1);
return sendJSDataStream(this._connection!, data, streamId, chunkSize, () => this.changeActivity(-1));
}
public resolveElement(sequenceOrIdentifier: string): LogicalElement {
// It may be a root component added by JS
const jsAddedComponentContainer = getAndRemovePendingRootComponentContainer(sequenceOrIdentifier);
if (jsAddedComponentContainer) {
return toLogicalElement(jsAddedComponentContainer, true);
}
// ... or it may be a root component added by .NET
const parsedSequence = Number.parseInt(sequenceOrIdentifier);
if (!Number.isNaN(parsedSequence)) {
const descriptor = this._componentManager.resolveRootComponent(parsedSequence);
return toLogicalRootCommentElement(descriptor);
}
throw new Error(`Invalid sequence number or identifier '${sequenceOrIdentifier}'.`);
}
public getRootComponentManager(): RootComponentManager<ServerComponentDescriptor> {
return this._componentManager;
}
public getEventRegistry(): JSEventRegistry {
return this._eventRegistry;
}
private unhandledError(err: Error): void {
this._logger.log(LogLevel.Error, err);
// Disconnect on errors.
// Trying to call methods on the connection after its been closed will throw.
this.disconnect();
}
View on GitHub (pinned to 3600ca084e)