siyuan-note/siyuan · error

card cover source [ ] does not match view [ ]

Error message

card cover source [%s] does not match view [%s]

What it means

setAttrViewCardCoverPosition recomputes the view's current cover source (from Gallery.CoverFrom or Kanban.CoverFrom) and requires the request's source to match it. If the payload's source differs from the view's configured source, this mismatch error is returned. The position can only be set for the source the view is actually using.

Solutions

  1. Read the target view's current coverFrom (gallery or kanban layout) and send that as data.source.
  2. First update the view's cover source configuration to the desired source, then set the position.
  3. Re-fetch the latest attribute view state to resolve stale view IDs or concurrently changed settings.

Example fix

// before
await setCardCoverPosition(avID, viewID, rowID, "field", pos);
// after
const view = await getAttrView(avID, viewID);
const src = view.layoutType === "gallery" ? view.gallery.coverFrom : view.kanban.coverFrom;
await setCardCoverPosition(avID, viewID, rowID, src, pos);
Defensive patterns

Strategy: fallback

Validate before calling

const view = await getAttrView(avID, viewID);
const currentSource = view.layoutType === "gallery" ? view.gallery.coverFrom : view.kanban.coverFrom;
if (currentSource !== requestedSource) requestedSource = currentSource;

Try / catch

try { await setCardCoverPosition(...); } catch (e) { if (String(e).includes("does not match view")) await refreshAndApplyCurrentSource(); else throw e; }

Prevention

When it happens

Trigger: doSetAttrViewCardCoverPosition sent with data.source set to e.g. the asset-field source while the target view's gallery/kanban cover is configured from the uploaded image (or vice versa), or targeting a view whose cover source was changed by another client.

Common situations: Clients caching an old cover source; operations sent against the wrong view ID after the user switched views or layouts; concurrent edits where another session changed coverFrom.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/attribute_view.go:2095

	}
	if nil == attrView.GetBlockValue(operation.RowID) {
		return fmt.Errorf("attribute view item [%s] not found", operation.RowID)
	}
	view, err := getAttrViewViewByBlockID(attrView, operation.BlockID)
	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

View on GitHub (pinned to 9f775e8a12)