siyuan-note/siyuan · error
key not found
Error message
key not found
What it means
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.
Source
Thrown at kernel/av/av.go:1297
if !gulu.File.IsDir(av) {
if err := os.MkdirAll(av, 0755); err != nil {
logging.LogErrorf("create attribute view dir failed: %s", err)
return
}
}
return
}
func GetAttributeViewI18n(key string) string {
return util.AttrViewLangs[util.Lang][key].(string)
}
var (
ErrAttributeViewNotFound = errors.New("attribute view not found")
ErrInvalidAttributeViewID = errors.New("invalid attribute view id")
ErrInvalidBoxID = errors.New("invalid box id")
ErrViewNotFound = errors.New("view not found")
ErrKeyNotFound = errors.New("key not found")
ErrItemNotFound = errors.New("item not found")
ErrWrongLayoutType = errors.New("wrong layout type")
ErrInvalidColumnAlign = errors.New("invalid column align")
ErrSpecTooNew = errors.New("attribute view spec is too new")
ErrFilterTooDeep = errors.New("filter nesting depth exceeds the maximum allowed")
)
const (
NodeAttrNameAvs = "custom-avs" // 用于标记块所属的属性视图,逗号分隔 av id
NodeAttrView = "custom-sy-av-view" // 用于标记块所属的属性视图视图 view id Database block support specified view https://github.com/siyuan-note/siyuan/issues/10443
NodeAttrVisibleViewIDs = "custom-sy-av-visible-views" // 用于标记数据库块显示的视图 ID,逗号分隔
NodeAttrViewStaticText = "custom-sy-av-s-text" // 用于标记块所属的属性视图静态文本 Database-bound block primary key supports setting static anchor text https://github.com/siyuan-note/siyuan/issues/10049
NodeAttrViewNames = "av-names" // 用于临时标记块所属的属性视图名称,空格分隔
)
View on GitHub (pinned to 251596fc0d)
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.
Example fix
// before
op := &av.Operation{Action: "setfilter", keyID: staleColumnID}
// after: resolve the column id from a freshly loaded AV
attrView, _ := av.ParseAttributeView(avID)
key, _ := attrView.GetKeyByName("Status")
op := &av.Operation{Action: "setfilter", keyID: key.ID} Defensive patterns
Strategy: try-catch
Try / catch
key, err := attrView.GetKey(keyID)
if errors.Is(err, av.ErrKeyNotFound) {
// column was deleted; drop filters/sorts referencing it and reload
reloadAVSchema(avID)
return nil
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/35fecac49b78407f.
Report an issue: GitHub.