{"record":{"id":"87bf1c083781d9b5","repo":"siyuan-note/siyuan","slug":"field-s-not-found-in-view-s","errorCode":null,"errorMessage":"field [%s] not found in view [%s]","messagePattern":"field \\[(.+?)\\] not found in view \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":1949,"sourceCode":"\t\t\tif field.ID == operation.ID {\n\t\t\t\tfield.FullRow = fullRow\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\tcase av.LayoutTypeKanban:\n\t\tfor _, field := range view.Kanban.Fields {\n\t\t\tif field.ID == operation.ID {\n\t\t\t\tfield.FullRow = fullRow\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn av.ErrWrongLayoutType\n\t}\n\tif !found {\n\t\treturn fmt.Errorf(\"field [%s] not found in view [%s]\", operation.ID, view.ID)\n\t}\n\n\terr = av.SaveAttributeView(attrView)\n\treturn\n}\n\nfunc getAttrViewOperationView(attrView *av.AttributeView, operation *Operation) (ret *av.View, err error) {\n\tif \"\" != operation.ViewID {\n\t\tret = attrView.GetView(operation.ViewID)\n\t\tif nil == ret {\n\t\t\terr = av.ErrViewNotFound\n\t\t}\n\t\treturn\n\t}\n\treturn getAttrViewViewByBlockID(attrView, operation.BlockID)\n}\n\nfunc getAttrViewOperationNumber(operation *Operation) (ret float64, err error) {","sourceCodeStart":1931,"sourceCodeEnd":1967,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view.go#L1931-L1967","documentation":"After switching on the view layout, setAttrViewColFullRow searches the view's fields for operation.ID; if the field is not present in that view (for table/kanban/gallery layouts) it reports that the field was not found. The operation also returns av.ErrWrongLayoutType for layouts that do not support full-row fields.","triggerScenarios":"Sending setAttrViewColFullRow with operation.ID set to a field (Key/Column) ID that does not exist in the target view — wrong view ID in the operation, deleted field, or an ID from another database.","commonSituations":"Stale field ID cached after the column was removed; passing the field name instead of its ID; targeting the wrong avID/view so the lookup runs against an unrelated view; concurrent edits between listing fields and toggling.","solutions":["Verify operation.ID matches an existing key/column ID of the exact view (re-fetch the attribute view and check view fields) before sending.","Use the field's ID, not its name or UI label.","If the field was deleted, skip or recreate the field instead of retrying the toggle.","Ensure operation.AvID and the view selection match the view containing the field."],"exampleFix":"// before\nsetColFullRow(avID, viewId, fieldName); // name, not ID\n// after\nconst field = view.fields.find(f => f.name === fieldName);\nif (field) setColFullRow(avID, viewId, field.id);","handlingStrategy":"validation","validationCode":"const view = attrView.views.find(v => v.id === viewID);\nif (!view || !view.fields.some(f => f.id === fieldID)) throw new Error('field not found in view: ' + fieldID);","typeGuard":"const fieldExists = (view: { fields: { id: string }[] } | undefined, id: string): boolean => !!view && view.fields.some(f => f.id === id);","tryCatchPattern":"try { await setColFullRow(avID, viewID, fieldID, fullRow); } catch (e) { if (String(e).includes('not found in view')) { await refreshAttrView(avID); } else throw e; }","preventionTips":["Always send field IDs, not names or UI labels","Re-fetch fields after any column add/remove before toggling","Confirm operation.AvID and view selection match the field's owning view","Skip operations for fields that were deleted concurrently"],"tags":["attribute-view","not-found","field-lookup"],"backgroundTag":"record-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"}