{"record":{"id":"bcb9925ce7bae93f","repo":"siyuan-note/siyuan","slug":"invalid-column-align","errorCode":null,"errorMessage":"invalid column align","messagePattern":"invalid column align","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/av.go","lineNumber":1300,"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\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\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":1282,"sourceCodeEnd":1313,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/av/av.go#L1282-L1313","documentation":"Sentinel ErrInvalidColumnAlign. Returned by the column-align operation handler (model/attribute_view.go:6393) when operation.Data cannot be asserted to a string, or the resulting av.TableColumnAlign value fails IsValid(). Only applies to table-layout views (guarded earlier by av.LayoutTypeTable check).","triggerScenarios":"Sending a setcolalign operation whose Data is not a string, or is a string that is not one of the recognized align enum names/values. Also if the client sends a numeric align code that does not map to a valid TableColumnAlign.","commonSituations":"Client bug sending align as a number instead of the enum string; a newer/older client using an align value the server does not recognize; malformed operation payload from a plugin.","solutions":["Send the align value in the exact form the server's TableColumnAlign expects (check the IsValid enum set).","Ensure operation.Data is a JSON string, not a number or object.","Update the client to a version whose align constants match the server."],"exampleFix":"// before\nop := &av.Operation{Action: \"setcolalign\", ID: colID, Data: 2}   // number -> invalid\n\n// after: send the canonical align string\nop := &av.Operation{Action: \"setcolalign\", ID: colID, Data: \"center\"}","handlingStrategy":"validation","validationCode":"// Ensure align is a valid enum string before submitting\nalign, ok := operation.Data.(string)\nif !ok { return errors.New(\"align must be a string\") }\na := av.TableColumnAlign(align)\nif !a.IsValid() { return fmt.Errorf(\"invalid align value %q\", align) }","typeGuard":"// TypeScript guard — match the server's TableColumnAlign set\nconst VALID_ALIGN = new Set([\"left\", \"center\", \"right\"])\nfunction isValidAlign(v: unknown): v is string {\n  return typeof v === \"string\" && VALID_ALIGN.has(v)\n}","tryCatchPattern":null,"preventionTips":["Send align as the canonical enum string, never a number.","Keep the client's align constants aligned with the server's TableColumnAlign.IsValid set.","Only issue setcolalign against table-layout views."],"tags":["attribute-view","validation","column","table","api"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}