{"record":{"id":"a86e482cc686b313","repo":"siyuan-note/siyuan","slug":"view-s-not-found","errorCode":null,"errorMessage":"view [%s] not found","messagePattern":"view \\[(.+?)\\] not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":6986,"sourceCode":"\tif err != nil {\n\t\treturn\n\t}\n\terr = av.SaveAttributeView(attrView)\n\treturn\n}\n\nfunc setAttributeViewFieldsHidden(attrView *av.AttributeView, keyID string, viewIDs []string, hidden bool) (err error) {\n\tvar fields []*av.BaseField\n\tseen := map[string]bool{}\n\tfor _, viewID := range viewIDs {\n\t\tif seen[viewID] {\n\t\t\tcontinue\n\t\t}\n\t\tseen[viewID] = true\n\n\t\tview := attrView.GetView(viewID)\n\t\tif nil == view {\n\t\t\treturn fmt.Errorf(\"view [%s] not found\", viewID)\n\t\t}\n\t\tfield := getAttributeViewField(view, keyID)\n\t\tif nil == field {\n\t\t\treturn fmt.Errorf(\"field [%s] not found in view [%s]\", keyID, viewID)\n\t\t}\n\t\tfields = append(fields, field)\n\t}\n\n\tif 1 > len(fields) {\n\t\treturn errors.New(\"view IDs is empty\")\n\t}\n\tfor _, field := range fields {\n\t\tfield.Hidden = hidden\n\t}\n\treturn\n}\n\nfunc getAttributeViewField(view *av.View, keyID string) (ret *av.BaseField) {","sourceCodeStart":6968,"sourceCodeEnd":7004,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view.go#L6968-L7004","documentation":"When hiding/showing a field across multiple views (setAttrViewViewFields... path), the kernel resolves each requested view ID via attrView.GetView. A nil result means the attribute view has no view with that ID, so the operation aborts with the view ID in the message.","triggerScenarios":"Calling the set-attribute-view-field-hidden style API with a viewIDs array containing a deleted, renamed (re-created), or mistyped view ID.","commonSituations":"Stale IDs cached by a plugin after the user deleted or duplicated the view; typos when hand-crafting API calls; operating on an old snapshot of the .av JSON.","solutions":["Re-read the attribute view and confirm the view ID exists in its \"views\" array","Remove or correct the invalid entry in the viewIDs list","Refresh any cached view IDs in the plugin after view add/delete operations"],"exampleFix":"// before\nsetAttrViewFieldHidden(avID, [\"staleViewID\"], keyID, true)\n// after\nconst view = (await getBlockAttr(avID)).views.find(v => v.id === viewID); // verify first\nsetAttrViewFieldHidden(avID, [view.id], keyID, true)","handlingStrategy":"validation","validationCode":"const av = await getAttributeView(avID);\nconst missing = viewIDs.filter(id => !av.views.some(v => v.id === id));\nif (missing.length) throw new Error(`unknown view IDs: ${missing.join(\",\")}`);","typeGuard":"const viewExists = (av: {views: {id: string}[]}, viewID: string): boolean => av.views.some(v => v.id === viewID);","tryCatchPattern":"try { await setAttrViewFieldHidden(avID, viewIDs, keyID, hidden); } catch (e) { if (String(e).includes(\"not found\")) { await refreshAvCache(avID); } else throw e; }","preventionTips":["Re-fetch view IDs after any view add/delete","Never hardcode view IDs in plugins","Subscribe to attribute-view update push events to invalidate caches"],"tags":["attribute-view","not-found","api"],"backgroundTag":"entity-not-found","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"}