toeverything/AFFiNE · error · BlockSuiteError

ValueNotExists

ValueNotExists

Error message

property ${propertyId} not found

What it means

Thrown by BlockQueryDataSource.getProperty() when no property in this.meta.properties has a key matching the given propertyId. BlockQueryDataSource is the data-source used by DataView blocks that query existing workspace blocks (rather than storing rows in a database block). The method is the lookup backing cellValueGet/propertyDataGet/propertyTypeGet for non-column properties, so any stale or foreign property id reaches it.

Source

Thrown at blocksuite/affine/blocks/data-view/src/data-source.ts:104

    this.workspace.slots.docListUpdated.subscribe(() => {
      this.workspace.docs.forEach(doc => {
        if (!this.docDisposeMap.has(doc.id)) {
          this.listenToDoc(doc.getStore());
        }
      });
      this.docDisposeMap.forEach((_, id) => {
        if (!this.workspace.docs.has(id)) {
          this.docDisposeMap.get(id)?.();
          this.docDisposeMap.delete(id);
        }
      });
    });
  }

  private getProperty(propertyId: string) {
    const property = this.meta.properties.find(v => v.key === propertyId);
    if (!property) {
      throw new BlockSuiteError(
        BlockSuiteError.ErrorCode.ValueNotExists,
        `property ${propertyId} not found`
      );
    }
    return property;
  }

  private newColumnName() {
    let i = 1;
    while (
      this.block.props.columns.some(column => column.name === `Column ${i}`)
    ) {
      i++;
    }
    return `Column ${i}`;
  }

  cellValueChange(rowId: string, propertyId: string, value: unknown): void {

View on GitHub (pinned to 26c515e050)

Solutions

  1. Before calling cell/property getters, confirm propertyId is in dataSource.properties (which merges meta.properties keys and view column ids); skip the call if absent.
  2. If reading cell values, prefer the public cellValueGet path: it first checks getViewColumn(propertyId) and only falls through to getProperty for meta properties — pass a real meta property key, not a column id.
  3. On schema/migration changes, run a cleanup pass that strips cell entries whose propertyId is no longer in dataSource.properties to avoid stale lookups.
  4. If you maintain a custom BlockMeta, ensure its properties[].key values are stable identifiers that survive migrations.

Example fix

// before
dataSource.propertyTypeGet(stalePropertyId); // throws ValueNotExists

// after
if (dataSource.properties.includes(propertyId)) {
  const type = dataSource.propertyTypeGet(propertyId);
}
Defensive patterns

Strategy: validation

Validate before calling

function hasProperty(dataSource, propertyId) {
  return dataSource.properties.includes(propertyId);
}
// usage:
if (hasProperty(dataSource, propertyId)) {
  dataSource.propertyTypeGet(propertyId);
}

Type guard

import type { DataSourceBase } from '@blocksuite/data-view';
function isKnownProperty(ds: DataSourceBase, id: string): id is string {
  return ds.properties.includes(id);
}

Prevention

When it happens

Trigger: Calling cellValueGet(rowId, propertyId), propertyDataGet(propertyId), propertyNameGet(propertyId), propertyReadonlyGet(propertyId), or propertyTypeGet(propertyId) on a BlockQueryDataSource where propertyId is not a key in this.meta.properties AND not a view column id. This happens when a persisted cell references a property key that was removed, when a snapshot/import carries property ids foreign to the current block-meta config (blockMetaMap[config.type]), or when code passes a column id where a meta property key is expected.

Common situations: Opening an older document whose block-query data view stored cell values against property keys that no longer exist after a schema/migration change; switching a BlockQueryDataSource config.type so the selector/meta changes and old property keys vanish; importing or copy-pasting a data-view block across docs whose block-meta registrations differ.

Related errors


AI-assisted analysis of toeverything/AFFiNE@26c515e050 (2026-08-12). Data as JSON: /api/errors/d5168bc2b5decfaa. Report an issue: GitHub.