toeverything/AFFiNE · error · BlockSuiteError

DatabaseBlockError

DatabaseBlockError

Error message

no groupable column found

What it means

When creating a default Kanban view, kanbanViewModel.defaultData resolves a column to group by via resolveKanbanGroupBy(). If no column qualifies as groupable it throws DatabaseBlockError — a kanban view cannot be constructed without a grouping column.

Source

Thrown at blocksuite/affine/data-view/src/view-presets/kanban/define.ts:39

  sort?: Sort;
  header: {
    titleColumn?: string;
    iconColumn?: string;
    coverColumn?: string;
  };
  groupProperties: GroupProperty[];
};
export type KanbanViewData = BasicViewDataType<
  typeof kanbanViewType.type,
  DataType
>;
export const kanbanViewModel = kanbanViewType.createModel<KanbanViewData>({
  defaultName: 'Kanban View',
  dataViewManager: KanbanSingleView,
  defaultData: viewManager => {
    const groupBy = resolveKanbanGroupBy(viewManager.dataSource);
    if (!groupBy) {
      throw new BlockSuiteError(
        ErrorCode.DatabaseBlockError,
        'no groupable column found'
      );
    }

    const columns = viewManager.dataSource.properties$.value;

    return {
      columns: columns.map(id => ({
        id: id,
      })),
      filter: {
        type: 'group',
        op: 'and',
        conditions: [],
      },
      groupBy,
      header: {

View on GitHub (pinned to 26c515e050)

Solutions

  1. Ensure at least one groupable column type exists before offering the Kanban view.
  2. Disable/hide the Kanban view option when resolveKanbanGroupBy() returns null.
  3. Auto-add a select-type column when the user chooses Kanban with no groupable column.
Defensive patterns

Strategy: validation

Validate before calling

const groupBy = resolveKanbanGroupBy(dataSource);
if (!groupBy) { /* do not offer Kanban view, or add a groupable column first */ }

Type guard

const kanbanSupported = (ds: any): boolean => Boolean(resolveKanbanGroupBy(ds));

Prevention

When it happens

Trigger: Instantiating a Kanban view on a data source that has no groupable columns (e.g. all columns are number/formula/checkbox types unsupported for grouping).

Common situations: User tries to switch to Kanban view on a database lacking a select/multi-select or other groupable property; a freshly created database with only a title column.

Related errors


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