siyuan-note/siyuan · error

encrypted attribute view snapshot has no matching notebook

Error message

encrypted attribute view snapshot has no matching notebook [%s]

What it means

decryptHistoricalAttributeView checks snapshot/notebook consistency. The snapshot was found under a specific notebook (boxID), but that notebook is not marked as encrypted while the snapshot payload IS ciphertext. There is no key available for a non-encrypted notebook, so decryption is impossible and this error is returned, including the offending boxID.

Solutions

  1. Restore the notebook's encryption setting to match the snapshot's era (the notebook must be encrypted to read ciphertext snapshots).
  2. Find the snapshot copy under the notebook that was encrypted at that time and render history from that context instead.
  3. Re-create the history snapshot from the currently correctly configured notebook.
  4. Do not attempt to decrypt manually; use the encrypted-notebook recovery procedure in docs/ENCRYPTED-NOTEBOOK.md.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await renderHistoryAttributeView(avID, created);
} catch (e) {
  if (String(e.msg).startsWith("encrypted attribute view snapshot has no matching notebook")) {
    // restore the notebook's encrypted state or locate the snapshot under the originally encrypted notebook
  }
}

Prevention

When it happens

Trigger: Viewing history of an attribute view whose file is ciphertext but whose containing notebook in the snapshot is not an encrypted box — e.g. the notebook was toggled from encrypted to plain (or vice versa) after the snapshot was written, or the AV file was copied from an encrypted notebook into a plain notebook's history directory.

Common situations: Changing notebook encryption mode while old history snapshots retain the previous layout; manually copying storage/av files between notebooks of different encryption settings; restoring partial history data across notebooks.

Related errors


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

Appendix: source

Thrown at kernel/model/attribute_view_render.go:1498

	}
	attrView.CustomColorRenderContext = newHistoryAttributeViewCustomColorRenderContext(source.historyDir)
	attrView.ResolveDirectColors()

	viewable, err = renderAttributeView(attrView, "", viewID, carrierViewID, query, page, pageSize, groupPaging, false, false, nil, "")
	return
}

func decryptHistoricalAttributeView(boxID, avID string, data []byte) ([]byte, error) {
	ciphertext := util.IsCiphertext(data)
	if boxID == "" {
		if ciphertext {
			return nil, errors.New("encrypted attribute view snapshot is missing notebook context")
		}
		return data, nil
	}
	if !IsEncryptedBox(boxID) {
		if ciphertext {
			return nil, fmt.Errorf("encrypted attribute view snapshot has no matching notebook [%s]", boxID)
		}
		return data, nil
	}
	if !ciphertext {
		return nil, fmt.Errorf("encrypted notebook attribute view snapshot is plaintext [%s]", boxID)
	}
	return av.DecryptAVData(boxID, avID, data)
}

View on GitHub (pinned to 9f775e8a12)