{"record":{"id":"11aebf62be409708","repo":"siyuan-note/siyuan","slug":"card-cover-asset-field-s-not-found","errorCode":null,"errorMessage":"card cover asset field [%s] not found","messagePattern":"card cover asset field \\[(.+?)\\] not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/attribute_view.go","lineNumber":2100,"sourceCode":"\tif nil != err {\n\t\treturn\n\t}\n\tif av.LayoutTypeGallery != view.LayoutType && av.LayoutTypeKanban != view.LayoutType {\n\t\treturn av.ErrWrongLayoutType\n\t}\n\tvar source string\n\tif av.LayoutTypeGallery == view.LayoutType {\n\t\tsource = av.CardCoverSource(view.Gallery.CoverFrom, view.Gallery.CoverFromAssetKeyID)\n\t} else {\n\t\tsource = av.CardCoverSource(view.Kanban.CoverFrom, view.Kanban.CoverFromAssetKeyID)\n\t}\n\tif data.Source != source {\n\t\treturn fmt.Errorf(\"card cover source [%s] does not match view [%s]\", data.Source, view.ID)\n\t}\n\tif keyID := av.CardCoverSourceAssetKeyID(data.Source); \"\" != keyID {\n\t\tkey, getErr := attrView.GetKey(keyID)\n\t\tif nil != getErr || nil == key || av.KeyTypeMAsset != key.Type {\n\t\t\treturn fmt.Errorf(\"card cover asset field [%s] not found\", keyID)\n\t\t}\n\t}\n\n\tattrView.SetCardCoverPosition(operation.RowID, data.Source, data.Position)\n\terr = av.SaveAttributeView(attrView)\n\treturn\n}\n\nfunc AppendAttributeViewDetachedBlocksWithValues(avID string, blocksValues [][]*av.Value) (err error) {\n\tattrView, err := av.ParseAttributeView(avID)\n\tif err != nil {\n\t\tlogging.LogErrorf(\"parse attribute view [%s] failed: %s\", avID, err)\n\t\treturn\n\t}\n\n\tnow := util.CurrentTimeMillis()\n\tvar blockIDs []string\n\tfor _, blockValues := range blocksValues {","sourceCodeStart":2082,"sourceCodeEnd":2118,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/attribute_view.go#L2082-L2118","documentation":"When the requested cover source is field-based, the code resolves the asset key ID via av.CardCoverSourceAssetKeyID and looks it up in the attribute view. The error is returned if the key cannot be retrieved, is nil, or is not a multi-asset (KeyTypeMAsset) field. The cover cannot be positioned against a missing or wrong-type field.","triggerScenarios":"doSetAttrViewCardCoverPosition with a field-based cover source whose referenced asset key was deleted, or the key exists but is of a different type (e.g. a text or URL field instead of a multi-asset field).","commonSituations":"User deleted or recreated the asset column after a client cached its ID; plugin referencing a stale key ID; field type changed from m-asset to another type after configuration.","solutions":["Recreate the multi-asset (assets) column or update the view's coverFromAssetKeyID to an existing m-asset key ID.","List the attribute view's keys and pick the ID of a key whose type is 'masset'.","Re-configure the card cover source in the view settings, then retry the position operation."],"exampleFix":"// before\ncoverFromAssetKeyID = \"old-deleted-key-id\";\n// after\nconst key = av.keys.find(k => k.type === \"masset\");\ncoverFromAssetKeyID = key.id;","handlingStrategy":"validation","validationCode":"const key = (await getAttrView(avID)).keys.find(k => k.id === keyID);\nif (!key || key.type !== \"masset\") throw new Error(`key ${keyID} must exist and be an asset field`);","typeGuard":"const isAssetKey = (k?: { type: string }): k is { type: \"masset\" } => !!k && k.type === \"masset\";","tryCatchPattern":"try { await setCardCoverPosition(...); } catch (e) { if (String(e).includes(\"card cover asset field\") ) await promptUserToReconfigureCoverField(); else throw e; }","preventionTips":["Verify the referenced key exists and is of type masset before configuring coverFrom","Re-resolve key IDs after column edits or database rebuilds","Do not cache asset-key IDs across schema changes"],"tags":["attribute-view","card-cover","field-not-found"],"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"}