siyuan-note/siyuan · error

Encrypted notebook feature is already enabled

Error message

Encrypted notebook feature is already enabled

What it means

Error "Encrypted notebook feature is already enabled" thrown in siyuan-note/siyuan.

Source

Thrown at kernel/model/crypto.go:987

	return EnableEncryptedNotebook(password)
}

// EnableEncryptedNotebook 启用加密笔记本功能:生成 MasterSalt、派生 KEK、写入校验值并持久化。
// 重复调用(已启用)返回错误,避免覆盖现有加密笔记本的密钥参数。
// KEK 不缓存——启用后用户需对每个加密笔记本单独调 UnlockBox 解锁。
func EnableEncryptedNotebook(password string) error {
	if len(password) == 0 {
		return errors.New("password must not be empty")
	}

	notebookCryptoMu.Lock()
	defer notebookCryptoMu.Unlock()

	Conf.m.RLock()
	current := *Conf.NotebookCrypto
	Conf.m.RUnlock()
	if current.Enabled && notebookCryptoConfigurationComplete(&current) {
		return errors.New(Conf.Language(312))
	}

	hasEncrypted, listErr := hasEncryptedNotebook()
	if listErr != nil {
		return fmt.Errorf("list encrypted notebooks failed: %w", listErr)
	}
	hasHistory, historyErr := scanEncryptedNotebookHistory()
	if historyErr != nil {
		return fmt.Errorf("check encrypted notebook history failed: %w", historyErr)
	}
	hasBackup := filelock.IsExist(dataCryptoBackupPath())
	if hasEncrypted || hasHistory || hasBackup {
		// 现存笔记本、已删除笔记本历史或全局备份均表示已有密钥域,必须恢复并认证,不能生成新 MasterSalt。
		kek, restoreErr := tryRestoreNotebookCryptoFromBackupLocked(password)
		if kek != nil {
			zeroAndClear(kek)
		}
		if restoreErr != nil {

View on GitHub (pinned to afa823b6b4)

Solutions

  1. The encrypted notebook feature is already enabled; no action is needed.
  2. If you intended to change the master password, use the change master password function instead of enabling again.
  3. If you believe the state is wrong (e.g. config was reset), use the recovery flow with your original master password instead of re-enabling.

Example fix

Check the enabled flag before invoking the enable operation; disable the enable action in the UI when the feature is already active instead of reaching this error.

When it happens

Trigger: Thrown at kernel/model/crypto.go:987 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18). Data as JSON: /api/errors/c5d671ef22292988. Report an issue: GitHub.