siyuan-note/siyuan · error
Conf.Language(315)
Error message
Conf.Language(315)
What it means
Conf.Language(315) is the localized message telling the user that no notebook-encryption key backup file exists. ExportNotebookCryptoBackup reads <DataDir>/.siyuan/data-crypto-backup.json to produce a downloadable backup, and returns this error when that internal backup file has not been created (os.IsNotExist).
Solutions
- First complete notebook encryption setup (set/confirm the master password in Settings - About - Notebook encryption) so the kernel writes data-crypto-backup.json, then export again
- Check that <workspace>/data/.siyuan/data-crypto-backup.json exists on disk and restore it from a workspace backup if it was deleted
- If encryption was never enabled, there is nothing to back up — enable encryption first if a key backup is desired
Example fix
// caller-side precheck
const check = await fetchSyncPost("/api/notebook/lsNotebooks", {});
// guard in UI: only enable Export backup button after crypto setup completed
if (!window.siyuan.config.localNotebookCrypto?.enabled) { showMessage("Enable notebook encryption first"); return; }
await fetchPost("/api/notebook/exportNotebookCryptoBackup", {}); Defensive patterns
Strategy: validation
Validate before calling
const crypto = window.siyuan?.config?.localNotebookCrypto;
if (!crypto?.enabled) { showMessage("Notebook encryption is not configured; nothing to back up"); return; } Type guard
const hasCryptoBackup = (cfg) => !!cfg && cfg.enabled === true;
Try / catch
try {
const res = await fetchSyncPost("/api/notebook/exportNotebookCryptoBackup", {});
if (res.code !== 0) showMessage(res.msg);
} catch (e) {
// Language(315): internal backup file missing -> run crypto setup first
showMessage("No key backup found; complete encryption setup first");
} Prevention
- Complete encryption setup (which writes the internal backup) before offering export
- Never delete the hidden <workspace>/data/.siyuan directory during cleanup
- Export and store the key backup immediately after enabling encryption
When it happens
Trigger: Calling model.ExportNotebookCryptoBackup() (kernel/model/crypto.go:289) when the internal data-crypto-backup.json file does not exist — notebook encryption was never fully configured/confirmed (no backup was written at setup), or the file was manually deleted from the workspace data directory.
Common situations: Trying to export the key backup before ever enabling notebook encryption or completing the master-password setup that writes the backup; cleaning the workspace's hidden .siyuan directory and removing the file; migrating a workspace without the hidden file.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- 26
- cannot generate notebook crypto backup without KEK
- cannot save incomplete notebook crypto configuration
- Conf.Language(12) (localized asset-not-found message)
- Conf.Language(324)
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/69b7c96dbb7239a9.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/crypto.go:289
tmpPath := path + "." + gulu.Rand.String(7) + ".tmp"
if err := os.WriteFile(tmpPath, data, 0644); err != nil {
return err
}
return os.Rename(tmpPath, path)
}
// ExportNotebookCryptoBackup 把密钥备份文件复制到 export 目录,返回可下载的相对路径。
// 供用户主动导出保存,作为同步之外的独立恢复途径(详见设计文档 §4.1)。
// 备份文件本身不含主密码(salt 不保密、verifier 是密文),拿到它也解不开任何数据。
func ExportNotebookCryptoBackup() (downloadPath string, err error) {
notebookCryptoMu.Lock()
defer notebookCryptoMu.Unlock()
backupPath := dataCryptoBackupPath()
data, readErr := filelock.ReadFile(backupPath)
if readErr != nil {
if os.IsNotExist(readErr) {
err = errors.New(Conf.Language(315))
return
}
err = readErr
return
}
exportBase := filepath.Join(util.TempDir, "export")
if mkErr := os.MkdirAll(exportBase, 0755); mkErr != nil {
err = mkErr
return
}
// 用随机名避免不同用户/设备互相覆盖,文件名固定带易识别前缀
fileName := "notebook-crypto-backup-" + gulu.Rand.String(7) + ".json"
downloadPath = "/export/" + url.PathEscape(fileName)
if writeErr := os.WriteFile(filepath.Join(exportBase, fileName), data, 0644); writeErr != nil {
err = writeErr
return
}
returnView on GitHub (pinned to 9f775e8a12)