toeverything/AFFiNE · error
Version mismatch for block ${this.model.id}, expected ${expe
Error message
Version mismatch for block ${this.model.id}, expected ${expectedVersion}, actual ${actualVersion} What it means
Warning logged by `isVersionMismatch` when the block model's stored version differs from the version declared by its registered schema — the doc data was written by an editor with a different schema version. The getter returns true so the UI can show a version-mismatch state rather than rendering potentially incompatible block data.
Source
Thrown at blocksuite/framework/std/src/view/element/block-component.ts:99
return this.model.flavour;
}
get host() {
return this.std.host;
}
get isVersionMismatch() {
const schema = this.store.schema.flavourSchemaMap.get(this.model.flavour);
if (!schema) {
console.warn(
`Schema not found for block ${this.model.id}, flavour ${this.model.flavour}`
);
return true;
}
const expectedVersion = schema.version;
const actualVersion = this.model.version;
if (expectedVersion !== actualVersion) {
console.warn(
`Version mismatch for block ${this.model.id}, expected ${expectedVersion}, actual ${actualVersion}`
);
return true;
}
return false;
}
get model() {
if (this._model) {
return this._model;
}
const model = this.store.getModelById<Model>(this.blockId);
if (!model) {
throw new BlockSuiteError(
ErrorCode.MissingViewModelError,
`Cannot find block model for id ${this.blockId}`
);View on GitHub (pinned to b4c8548c09)
Solutions
- Migrate the block data to the expected version.
- Align the schema version with the stored data.
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when a block model's stored data version differs from the version declared by its registered schema, flagging the block as needing migration.
Common situations: Occurs when opening older documents after a schema upgrade. Run the doc migration so block data is updated to the expected version.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/f721ae956bd1ff00.
Report an issue: GitHub.