siyuan-note/siyuan · error

card cover asset field

Error message

card cover asset field [%s] not found

What it means

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.

Solutions

  1. Recreate the multi-asset (assets) column or update the view's coverFromAssetKeyID to an existing m-asset key ID.
  2. List the attribute view's keys and pick the ID of a key whose type is 'masset'.
  3. Re-configure the card cover source in the view settings, then retry the position operation.

Example fix

// before
coverFromAssetKeyID = "old-deleted-key-id";
// after
const key = av.keys.find(k => k.type === "masset");
coverFromAssetKeyID = key.id;
Defensive patterns

Strategy: validation

Validate before calling

const key = (await getAttrView(avID)).keys.find(k => k.id === keyID);
if (!key || key.type !== "masset") throw new Error(`key ${keyID} must exist and be an asset field`);

Type guard

const isAssetKey = (k?: { type: string }): k is { type: "masset" } => !!k && k.type === "masset";

Try / catch

try { await setCardCoverPosition(...); } catch (e) { if (String(e).includes("card cover asset field") ) await promptUserToReconfigureCoverField(); else throw e; }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/11aebf62be409708. Report an issue: GitHub.

Appendix: source

Thrown at kernel/model/attribute_view.go:2100

	if nil != err {
		return
	}
	if av.LayoutTypeGallery != view.LayoutType && av.LayoutTypeKanban != view.LayoutType {
		return av.ErrWrongLayoutType
	}
	var source string
	if av.LayoutTypeGallery == view.LayoutType {
		source = av.CardCoverSource(view.Gallery.CoverFrom, view.Gallery.CoverFromAssetKeyID)
	} else {
		source = av.CardCoverSource(view.Kanban.CoverFrom, view.Kanban.CoverFromAssetKeyID)
	}
	if data.Source != source {
		return fmt.Errorf("card cover source [%s] does not match view [%s]", data.Source, view.ID)
	}
	if keyID := av.CardCoverSourceAssetKeyID(data.Source); "" != keyID {
		key, getErr := attrView.GetKey(keyID)
		if nil != getErr || nil == key || av.KeyTypeMAsset != key.Type {
			return fmt.Errorf("card cover asset field [%s] not found", keyID)
		}
	}

	attrView.SetCardCoverPosition(operation.RowID, data.Source, data.Position)
	err = av.SaveAttributeView(attrView)
	return
}

func AppendAttributeViewDetachedBlocksWithValues(avID string, blocksValues [][]*av.Value) (err error) {
	attrView, err := av.ParseAttributeView(avID)
	if err != nil {
		logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
		return
	}

	now := util.CurrentTimeMillis()
	var blockIDs []string
	for _, blockValues := range blocksValues {

View on GitHub (pinned to 9f775e8a12)