siyuan-note/siyuan · error

encrypted notebook attribute view snapshot is plaintext

Error message

encrypted notebook attribute view snapshot is plaintext [%s]

What it means

decryptHistoricalAttributeView enforces encryption consistency in the other direction: the notebook (boxID) is marked encrypted, but the snapshot attribute view file is plaintext. An encrypted notebook must never contain plaintext AV snapshots, so the kernel rejects the data rather than silently accepting an inconsistent (possibly corrupted or tampered) snapshot.

Solutions

  1. Copy the correct encrypted snapshot file into the history directory (verify it is ciphertext) or regenerate the snapshot from the encrypted notebook.
  2. Check for mixed-version restore artifacts and rebuild history from the source notebook.
  3. Verify the notebook's encryption flag is intentional; if the notebook should be plain, fix the flag consistency at the notebook level rather than editing the snapshot.
  4. Follow the encrypted-notebook compatibility rules in docs/ENCRYPTED-NOTEBOOK.md; never hand-edit ciphertext.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await renderHistoryAttributeView(avID, created);
} catch (e) {
  if (String(e.msg).startsWith("encrypted notebook attribute view snapshot is plaintext")) {
    // regenerate the history snapshot from the encrypted notebook; do not hand-edit files
  }
}

Prevention

When it happens

Trigger: Viewing history of an attribute view under an encrypted notebook where the snapshot file storage/av/<avID>.json was written as plaintext — e.g. produced by a kernel version or tool that skipped encryption, or the file was copied from a plain notebook into an encrypted notebook's history directory.

Common situations: Mixed-version histories after upgrading encryption support; scripts or sync tools copying raw .json AV files between plain and encrypted notebooks; partially restored backups where only some files were encrypted.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at kernel/model/attribute_view_render.go:1503

	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)