siyuan-note/siyuan · error
Conf.Language(123)
Error message
Conf.Language(123)
What it means
SyncDataBeforeEnableEncryptedNotebook (called from crypto.go:954) aborts with Conf.Language(123) = 'The synchronization function can only be activated after adding/selecting the cloud synchronization directory' when Conf.Sync.CloudName fails cloud.IsValidCloudDirName. Enabling an encrypted notebook requires a prior full sync, and that sync needs a valid cloud directory/bucket selected.
Source
Thrown at kernel/model/sync.go:229
if 1 == code {
// 启动同步成功后消费本地速记临时文件,避免移动端开启云同步时需手动触发同步才能刷新闪念速记
consumeShorthands()
}
return
}
func SyncData(byHand bool) {
syncData(false, byHand)
}
// SyncDataBeforeEnableEncryptedNotebook 在启用加密笔记本前执行一次完整同步。
// 未启用数据同步时直接返回;已启用数据同步时,任何同步失败都会阻止继续创建新的密钥体系。
func SyncDataBeforeEnableEncryptedNotebook() error {
if !Conf.Sync.Enabled {
return nil
}
if !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
return errors.New(Conf.Language(123))
}
if !checkSync(false, false, true) {
return errors.New(Conf.Language(53))
}
// 不复用请求合并状态,确保调用返回前确实完成了一次由当前启用操作发起的完整同步。
lockSync()
defer unlockSync()
if err := syncDataLocked(false, true); err != nil {
if Conf.Sync.Stat != "" {
return errors.New(Conf.Sync.Stat)
}
return err
}
return nil
}
func lockSync() {View on GitHub (pinned to 251596fc0d)
Solutions
- Open Settings - Cloud - Cloud sync directory and either create or select a valid directory first.
- Ensure CloudName matches \w[-\w]*, no spaces/symbols, length <= 63 (cloud.IsValidCloudDirName rules).
- After selecting the directory, retry enabling notebook encryption.
Example fix
// before: Sync.Enabled=true, CloudName="" -> error 123
// after: pick a directory first
if !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
Conf.Sync.CloudName = "main" // or CreateCloudSyncDir then set
Conf.Save()
} Defensive patterns
Strategy: validation
Validate before calling
// Go: gate the encryption-enable action
if Conf.Sync.Enabled && !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
return errors.New("select a cloud sync directory before enabling encryption")
} Type guard
// Go
func syncDirReady() bool {
return Conf.Sync.Enabled && cloud.IsValidCloudDirName(Conf.Sync.CloudName)
} Prevention
- In the encryption-enable UI, pre-check that a cloud sync directory exists; disable Enable if not.
- When changing sync provider, validate CloudName against the new provider's naming rules.
- Document that encryption requires both sync enabled and a valid directory.
When it happens
Trigger: The user turns on notebook encryption while data sync is enabled in Settings but no valid cloud sync directory is configured (CloudName empty, contains spaces/special chars, or exceeds 63 chars). The crypto-enable flow calls SyncDataBeforeEnableEncryptedNotebook, which short-circuits before any network call.
Common situations: Sync was enabled with a stale or cleared CloudName after a provider switch. The cloud directory was deleted out-of-band and the local config still references it. Fresh install where sync was toggled on but the directory was never created/selected.
Related errors
AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12).
Data as JSON: /api/errors/8d92c49575798723.
Report an issue: GitHub.