siyuan-note/siyuan · error
save encrypted notebook conf failed: %w
Error message
save encrypted notebook conf failed: %w
What it means
Returned by CreateEncryptedBox when box.SaveConf fails to persist the encrypted notebook's .syconf to disk. The %w wraps the underlying I/O error. The notebook directory was already created and metadata encrypted, but the configuration file couldn't be written — the deferred cleanup (cleanupFailedEncryptedBox) will remove the half-created box.
Source
Thrown at kernel/model/crypto.go:2580
cleanupFailedEncryptedBox(createdBoxID)
id = ""
}
}()
enc, dek, err := WrapNewDEK(id, kek)
if err != nil {
return "", err
}
box := &Box{ID: id}
boxConf := box.GetConf()
boxConf.Encrypted = true
boxConf.BoxCrypt = enc
if err = encryptBoxMetadata(id, boxConf, dek); err != nil {
return "", fmt.Errorf("encrypt notebook metadata failed: %w", err)
}
if err = box.SaveConf(boxConf); err != nil {
return "", fmt.Errorf("save encrypted notebook conf failed: %w", err)
}
if err = writeNotebookCryptBackup(id, enc); err != nil {
return "", fmt.Errorf("write notebook crypt backup failed: %w", err)
}
// 回读校验加密配置已落盘,避免写失败后按普通笔记本处理
verifyConf := box.GetConf()
if verifyConf == nil || !verifyConf.Encrypted || verifyConf.BoxCrypt == nil {
err = errors.New("encrypted notebook metadata verification failed after write")
return "", err
}
markRuntimeEncryptedBox(id)
invalidateEncryptedPublishAccessCache()
// 复用刚派生的 DEK 直接开 db + 缓存,省去再次 Argon2id 解锁
cachedDEKsLock.Lock()
if err = sql.OpenEncryptedDB(id, dek); err != nil {
cachedDEKsLock.Unlock()
return "", errView on GitHub (pinned to 251596fc0d)
Solutions
- Check free disk space on the workspace volume and free space if full.
- Verify the kernel process has write permission to the workspace/notebooks directory.
- Temporarily disable or exclude the workspace directory in antivirus software and retry.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check writable workspace
if info, err := os.Stat(util.WorkspaceDir); err != nil || info.Mode().Perm()&0200 == 0 {
return errors.New("workspace directory is not writable")
} Try / catch
id, err := model.CreateEncryptedBox(name, password)
if err != nil {
if strings.Contains(err.Error(), "save encrypted notebook conf failed") {
// disk/permission issue — guide user to check space/permissions
}
return err
} Prevention
- Check disk space and write permissions before initiating notebook creation.
- Add antivirus exclusions for the workspace directory.
- Avoid running the kernel against network-mounted filesystems with unreliable writes.
When it happens
Trigger: Disk full, permission denied on the workspace/notebook directory, read-only filesystem, or a file-lock conflict when writing the .syconf file.
Common situations: Workspace is on a full or nearly-full disk. User running the kernel without write permission to the workspace directory. Antivirus or file-locking software blocked the write. Network-mounted filesystem with intermittent write failures.
Related errors
- write notebook crypt backup failed: %w
- initialize encrypted notebook document failed: %w
- Encrypted notebooks already exist but the master key backup
- list encrypted notebooks failed: %w
- check encrypted notebook history failed: %w
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/cac525d38a94164d.
Report an issue: GitHub.