{"record":{"id":"4bb773fdbf394afd","repo":"siyuan-note/siyuan","slug":"errinvalidcolumnalign","errorCode":"ErrInvalidColumnAlign","errorMessage":"invalid column align","messagePattern":"invalid column align","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/av.go","lineNumber":1390,"sourceCode":"\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":1372,"sourceCodeEnd":1405,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/av/av.go#L1372-L1405","documentation":"ErrInvalidColumnAlign is returned when setting a table column's alignment with an align value that cannot be converted to a valid av.TableColumnAlign (conversion fails or the value is not a recognized enum member). It protects the persisted view spec from unknown alignment codes.","triggerScenarios":"setAttrViewColumnAlign-style operations where alignValue is not an integer convertible to TableColumnAlign or fails align.IsValid(); frontend sending align as a string or out-of-range code; plugin calling the alignment API with a custom constant.","commonSituations":"Older plugin built against a removed alignment constant; JSON payload where align arrives as null/0/undefined; locale/other bug mapping boolean wrap settings into the align field.","solutions":["Validate the align value against the TableColumnAlign enum before the API call","Coerce/parse the incoming JSON value to the expected integer type and range","Use the documented alignment constants rather than hard-coded numbers"],"exampleFix":"// before\nalignValue := req.Align // arbitrary value\n// after\nalign, ok := av.TableColumnAlign(req.Align)\nif !ok || !align.IsValid() {\n    return av.ErrInvalidColumnAlign\n}","handlingStrategy":"validation","validationCode":"align, ok := av.TableColumnAlign(rawAlign)\nif !ok || !align.IsValid() {\n    return errors.New(\"align must be a valid TableColumnAlign\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the exported alignment constants, never raw numbers","Coerce JSON align fields to int before sending","Update plugins when alignment enum changes"],"tags":["attribute-view","enum","validation"],"backgroundTag":"invalid-enum-value","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"}