{"record":{"id":"35fecac49b78407f","repo":"siyuan-note/siyuan","slug":"key-not-found","errorCode":null,"errorMessage":"key not found","messagePattern":"key not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/av/av.go","lineNumber":1297,"sourceCode":"\tif !gulu.File.IsDir(av) {\n\t\tif err := os.MkdirAll(av, 0755); err != nil {\n\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\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":1279,"sourceCodeEnd":1313,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/av/av.go#L1279-L1313","documentation":"Sentinel ErrKeyNotFound. Returned by (av).GetKey and GetKeyValues when the requested keyID (column id) is not present in the AV's KeyValues, and forwarded by many model-layer operations (filter/sort/value update at model/attribute_view.go:2487, 5347, 7681). The column was deleted or never existed in this AV.","triggerScenarios":"Sending an operation (setfilter, setsort, updatevalue, setkey) that references a column/key id that is not in the current AV schema. Common when the client cached an older schema after columns were added/removed elsewhere.","commonSituations":"Another client deleted the column between schema load and operation submit; a plugin hardcoded a column id; copy-pasting an operation payload from a different database.","solutions":["Reload the AV schema (GET /api/av/getAttributeView) and reference only current key ids.","Drop client-side filters/sorts that reference deleted columns before re-submitting.","When building operations programmatically, resolve key ids by name/type from a fresh schema each time."],"exampleFix":"// before\nop := &av.Operation{Action: \"setfilter\", keyID: staleColumnID}\n\n// after: resolve the column id from a freshly loaded AV\nattrView, _ := av.ParseAttributeView(avID)\nkey, _ := attrView.GetKeyByName(\"Status\")\nop := &av.Operation{Action: \"setfilter\", keyID: key.ID}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"key, err := attrView.GetKey(keyID)\nif errors.Is(err, av.ErrKeyNotFound) {\n    // column was deleted; drop filters/sorts referencing it and reload\n    reloadAVSchema(avID)\n    return nil\n}","preventionTips":["Resolve column ids from a freshly loaded schema each time.","Drop client-side filters/sorts that reference deleted columns.","Avoid hardcoding column ids in plugins."],"tags":["attribute-view","key","column","not-found","api"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}