toeverything/AFFiNE · error · BlockSuiteError
DatabaseBlockError
DatabaseBlockError
Error message
no groupable column found
What it means
The Kanban view model's defaultData (view-presets/kanban/define.ts:36-43) calls resolveKanbanGroupBy(dataSource). That helper keeps a still-groupable column, else picks one via pickKanbanGroupColumn, else auto-adds a 'Status' select column (ensureKanbanGroupColumn). If no existing column is groupable AND the fallback propertyAdd fails (returns undefined, e.g. a read-only data source), groupBy is undefined and creating a Kanban view throws DatabaseBlockError 'no groupable column found'.
Solutions
- Pre-check with pickKanbanGroupColumn(dataSource)/canGroupable before offering or adding the Kanban view
- Ensure the data source supports propertyAdd so the Status select fallback column can be auto-created
- Register kanbanGroup config plus a group-by service for custom column types
- Catch the error and fall back to adding a Table view, then add a select column and retry
Example fix
// before
viewManager.viewAdd('kanban'); // throws 'no groupable column found'
// after
if (!pickKanbanGroupColumn(dataSource)) {
dataSource.propertyAdd('end', { type: 'select', name: 'Status' });
}
viewManager.viewAdd('kanban'); Defensive patterns
Strategy: validation
Validate before calling
import { pickKanbanGroupColumn, canGroupable } from '../../view-presets/kanban/group-by-utils.js';
const columnId = pickKanbanGroupColumn(dataSource);
if (!columnId) {
// ensure a Status select column can be added, else keep table view
const added = dataSource.propertyAdd('end', { type: 'select', name: 'Status' });
if (!added) return; // do not add kanban view
}
viewManager.viewAdd('kanban'); Type guard
const canCreateKanbanView = (dataSource: DataSource): boolean =>
!!pickKanbanGroupColumn(dataSource) ||
!!dataSource.propertyAdd('end', { type: 'select', name: 'Status' }); Try / catch
try {
viewManager.viewAdd('kanban');
} catch (e) {
if (e instanceof BlockSuiteError && e.code === BlockSuiteError.ErrorCode.DatabaseBlockError) {
toast('Add a select column before creating a Kanban view');
return;
}
throw e;
} Prevention
- Only offer the Kanban view option when a groupable column exists or the data source accepts new properties
- Register kanbanGroup config and a group-by service for custom column types
- In read-only data sources, pre-create a groupable column before allowing view switches
When it happens
Trigger: Adding a Kanban view to a database where every column type has kanbanGroup disabled or lacks a group-by service match, while the data source cannot add properties; custom column types registered without kanbanGroup config or group-by matcher support.
Common situations: Kanban view offered in a context where the data source is read-only (card/detail panels); databases whose columns are all title/rich-text (not groupable); custom property types missing group-by registration.
Related errors
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/7487e1b90dbf90aa.
Report an issue: GitHub.
Appendix: 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 b4c8548c09)