{"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":1954,"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":1936,"sourceCodeEnd":1972,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/attribute_view.go#L1936-L1972","documentation":"Thrown by setAttrViewCardCoverPosition when the cover source is 'asset:<keyID>' but the referenced key either does not exist in the AttributeView (GetKey returns an error/nil) or is not of type KeyTypeMAsset (multi-asset). Cover-from-asset requires a live asset field to pull images from.","triggerScenarios":"The asset field used as the cover source was deleted or had its type changed (e.g. from mAsset to text); the CoverFromAssetKeyID points at a stale key ID; a corrupted AV where the keyID reference is dangling.","commonSituations":"User deletes the asset column whose images supplied the card cover; restoring an AV backup that lost a column; plugin/automation that removed keys without updating the view's cover config.","solutions":["On the client, validate that the asset keyID still exists and is of type mAsset before issuing the cover-position operation (use the AV key list).","If the field was deleted, first switch the view's cover source back to 'content' (or to another live asset field), then re-send the position operation.","Add a cleanup step when deleting mAsset keys to reset any view CoverFrom referencing them."],"exampleFix":"// before\nop.Data = { source: `asset:${deletedKeyID}`, position }\n// after\nconst keys = await getAttrViewKeys(avID)\nconst assetKey = keys.find(k => k.id === keyID && k.type === 'mAsset')\nif (!assetKey) {\n  // reset view cover to content first, then send position with source: 'content'\n} else {\n  op.Data = { source: `asset:${assetKey.id}`, position }\n}","handlingStrategy":"validation","validationCode":"const keyID = op.data.source.startsWith('asset:') ? op.data.source.slice(6) : ''\nif (keyID) {\n  const key = (await getAttrViewKeys(avID)).find(k => k.id === keyID)\n  if (!key || key.type !== 'mAsset') { /* reset cover source before sending */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When deleting an mAsset key, reset any view cover config that references it.","Validate the asset key exists and is mAsset before issuing cover-position updates."],"tags":["attribute-view","card-cover","dangling-reference","transaction"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}