{"record":{"id":"7487e1b90dbf90aa","repo":"toeverything/AFFiNE","slug":"databaseblockerror-7487e1","errorCode":"DatabaseBlockError","errorMessage":"no groupable column found","messagePattern":"no groupable column found","errorType":"exception","errorClass":"BlockSuiteError","httpStatus":null,"severity":"error","filePath":"blocksuite/affine/data-view/src/view-presets/kanban/define.ts","lineNumber":39,"sourceCode":"  sort?: Sort;\n  header: {\n    titleColumn?: string;\n    iconColumn?: string;\n    coverColumn?: string;\n  };\n  groupProperties: GroupProperty[];\n};\nexport type KanbanViewData = BasicViewDataType<\n  typeof kanbanViewType.type,\n  DataType\n>;\nexport const kanbanViewModel = kanbanViewType.createModel<KanbanViewData>({\n  defaultName: 'Kanban View',\n  dataViewManager: KanbanSingleView,\n  defaultData: viewManager => {\n    const groupBy = resolveKanbanGroupBy(viewManager.dataSource);\n    if (!groupBy) {\n      throw new BlockSuiteError(\n        ErrorCode.DatabaseBlockError,\n        'no groupable column found'\n      );\n    }\n\n    const columns = viewManager.dataSource.properties$.value;\n\n    return {\n      columns: columns.map(id => ({\n        id: id,\n      })),\n      filter: {\n        type: 'group',\n        op: 'and',\n        conditions: [],\n      },\n      groupBy,\n      header: {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/blocksuite/affine/data-view/src/view-presets/kanban/define.ts#L21-L57","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nviewManager.viewAdd('kanban'); // throws 'no groupable column found'\n\n// after\nif (!pickKanbanGroupColumn(dataSource)) {\n  dataSource.propertyAdd('end', { type: 'select', name: 'Status' });\n}\nviewManager.viewAdd('kanban');","handlingStrategy":"validation","validationCode":"import { pickKanbanGroupColumn, canGroupable } from '../../view-presets/kanban/group-by-utils.js';\n\nconst columnId = pickKanbanGroupColumn(dataSource);\nif (!columnId) {\n  // ensure a Status select column can be added, else keep table view\n  const added = dataSource.propertyAdd('end', { type: 'select', name: 'Status' });\n  if (!added) return; // do not add kanban view\n}\nviewManager.viewAdd('kanban');","typeGuard":"const canCreateKanbanView = (dataSource: DataSource): boolean =>\n  !!pickKanbanGroupColumn(dataSource) ||\n  !!dataSource.propertyAdd('end', { type: 'select', name: 'Status' });","tryCatchPattern":"try {\n  viewManager.viewAdd('kanban');\n} catch (e) {\n  if (e instanceof BlockSuiteError && e.code === BlockSuiteError.ErrorCode.DatabaseBlockError) {\n    toast('Add a select column before creating a Kanban view');\n    return;\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["database-block","kanban","view-creation","group-by"],"backgroundTag":"missing-groupable-column","analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}