{"record":{"id":"35c28e8ad440ea96","repo":"siyuan-note/siyuan","slug":"item-not-found","errorCode":null,"errorMessage":"item not found","messagePattern":"item not found","errorType":"http","errorClass":"ErrItemNotFound","httpStatus":null,"severity":"error","filePath":"kernel/av/av.go","lineNumber":1298,"sourceCode":"\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":1280,"sourceCodeEnd":1313,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/afa823b6b4e4f183511e0bc0a3be93caa94c7c97/kernel/av/av.go#L1280-L1313","documentation":"ErrItemNotFound is the sentinel error for a missing row/item in a SiYuan attribute view. It is raised in kernel/model/attribute_view.go:7748 (setAttrViewCellAttrView path) when attrView.GetBlockValue(itemID) returns nil, i.e. no row whose block value binds to itemID exists in the block key-values.","triggerScenarios":"Sending a setAttrViewCellAttrView / cell-update transaction operation with a rowID that was deleted from the database; referencing a detached row that was removed by another client between render and update; passing a block ID that exists in the note but was never bound as a row of this database.","commonSituations":"Stale editor state after a database was edited in a second window or on another synced device; a plugin caches rowIDs across schema/row changes; delete-row and update-cell operations race in the transaction queue.","solutions":["Re-render or re-fetch the database rows and use a current rowID before updating a cell","Check attrView.GetBlockValue(itemID) or ExistBoundBlock(itemID) before issuing the operation","Handle errors.Is(err, av.ErrItemNotFound) as a benign skip in transaction handlers so one stale row does not abort the batch","If rows were deleted by sync, reconcile by reloading the workspace data before retrying"],"exampleFix":"// before\nerr := tx.setAttributeViewCellAttrView(op) // may hit ErrItemNotFound\nif err != nil { return err }\n\n// after\nif nil == attrView.GetBlockValue(op.RowID) {\n    return nil // row already gone; nothing to update\n}\nerr := tx.setAttributeViewCellAttrView(op)\nif err != nil && strings.Contains(err.Error(), av.ErrItemNotFound.Error()) {\n    return nil\n}","handlingStrategy":"validation","validationCode":"if !attrView.ExistBoundBlock(rowID) && nil == attrView.GetBlockValue(rowID) {\n    return nil // row no longer exists; nothing to update\n}","typeGuard":"func isItemNotFound(err error) bool {\n    return errors.Is(err, av.ErrItemNotFound)\n}","tryCatchPattern":"err := applyCellUpdate(op)\nif err != nil {\n    if errors.Is(err, av.ErrItemNotFound) || strings.Contains(err.Error(), av.ErrItemNotFound.Error()) {\n        // row vanished mid-batch: log, skip, continue with next op\n    }\n}","preventionTips":["Refresh rowIDs from the current render before editing cells","Serialize delete-row and update-cell operations through the same transaction queue","For plugins, hook the database re-render push event and invalidate cached row IDs"],"tags":["siyuan","attribute-view","row","item","not-found","go"],"backgroundTag":"row-id-not-found","analyzedSha":"afa823b6b4e4f183511e0bc0a3be93caa94c7c97","analyzedAt":"2026-08-18T17:04:10.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}