{"record":{"id":"70fa901e4e1263a9","repo":"siyuan-note/siyuan","slug":"errwronglayouttype","errorCode":"ErrWrongLayoutType","errorMessage":"wrong layout type","messagePattern":"wrong layout type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/av.go","lineNumber":1389,"sourceCode":"\t\t\tlogging.LogErrorf(\"create attribute view dir failed: %s\", err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}\n\nfunc GetAttributeViewI18n(key string) string {\n\treturn util.AttrViewLangs[util.Lang][key].(string)\n}\n\nvar (\n\tErrAttributeViewNotFound  = errors.New(\"attribute view not found\")\n\tErrInvalidAttributeViewID = errors.New(\"invalid attribute view id\")\n\tErrInvalidBoxID           = errors.New(\"invalid box id\")\n\tErrViewNotFound           = errors.New(\"view not found\")\n\tErrKeyNotFound            = errors.New(\"key not found\")\n\tErrItemNotFound           = errors.New(\"item not found\")\n\tErrWrongLayoutType        = errors.New(\"wrong layout type\")\n\tErrInvalidColumnAlign     = errors.New(\"invalid column align\")\n\tErrSpecTooNew             = errors.New(\"attribute view spec is too new\")\n\tErrRichTextSpecMismatch   = errors.New(\"attribute view rich text requires storage spec 9\")\n\tErrFilterTooDeep          = errors.New(\"filter nesting depth exceeds the maximum allowed\")\n)\n\nconst (\n\tNodeAttrNameAvs        = \"custom-avs\"                  // 用于标记块所属的属性视图，逗号分隔 av id\n\tNodeAttrView           = \"custom-sy-av-view\"           // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443\n\tNodeAttrVisibleViewIDs = \"custom-sy-av-visible-views\"  // 用于标记数据库块显示的视图 ID，逗号分隔\n\tNodeAttrContextFilter  = \"custom-sy-av-context-filter\" // 用于保存数据库块独有的上下文筛选配置\n\tNodeAttrViewStaticText = \"custom-sy-av-s-text\"         // 用于标记块所属的属性视图静态文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049\n\n\tNodeAttrViewNames = \"av-names\" // 用于临时标记块所属的属性视图名称，空格分隔\n)\n","sourceCodeStart":1371,"sourceCodeEnd":1405,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/av.go#L1371-L1405","documentation":"ErrWrongLayoutType is returned when an operation is applied to an attribute view view whose layout type does not support it — e.g. card-layout, column-full-row, or cover-position settings only apply to table/gallery/kanban layouts, and model-level layout switchers reject unknown target layouts.","triggerScenarios":"setAttrViewCardLayout / setAttrViewColFullRow / setAttrViewCardCoverPosition called on a view whose LayoutType is not table/gallery/kanban; changeAttrViewLayout or CreateAttributeViewDatabase receiving a layout string outside the supported set.","commonSituations":"Frontend/plugin sending a layout id from an older or newer spec (e.g. a new layout type the current kernel doesn't know); a request payload where the layout field is a typo or empty; switching settings on a board after it was converted to another layout.","solutions":["Check view.LayoutType is one of av.LayoutTypeTable/Gallery/Kanban before applying layout-specific settings","Validate the layout parameter client-side against the current kernel's supported layout list","Update kernel/frontend together when a new layout type is introduced"],"exampleFix":"// before\nerr = setAttrViewCardBench(avID, viewID, layout) // any layout accepted\n// after\nswitch view.LayoutType {\ncase av.LayoutTypeTable, av.LayoutTypeGallery, av.LayoutTypeKanban:\n    // ok\ndefault:\n    return av.ErrWrongLayoutType\n}","handlingStrategy":"validation","validationCode":"switch view.LayoutType {\ncase av.LayoutTypeTable, av.LayoutTypeGallery, av.LayoutTypeKanban:\n    // proceed\ndefault:\n    return errors.New(\"layout does not support card settings\")\n}","typeGuard":"func supportsCardLayout(lt av.LayoutType) bool {\n    return lt == av.LayoutTypeTable || lt == av.LayoutTypeGallery || lt == av.LayoutTypeKanban\n}","tryCatchPattern":null,"preventionTips":["Gate layout-specific UI actions on the current view's LayoutType","Keep frontend and kernel layout enums in lockstep","Validate layout parameters at request boundaries"],"tags":["attribute-view","layout","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}