siyuan-note/siyuan · error
Data synchronization has not been enabled
Error message
Data synchronization has not been enabled
What it means
In SyncDataBeforeEnableEncryptedNotebook, after the directory check passes it calls checkSync(false,false,true); if that returns false it returns the localized message for key 53: 'Data synchronization has not been enabled'. checkSync gates on overall sync availability (enabled flag, provider setup, workspace readiness), so this error means the mandatory pre-encryption sync could not start.
Solutions
- Enable data synchronization fully in Settings - Sync (not just a directory) before enabling the encrypted notebook
- Wait for any running sync to complete and retry
- Verify provider configuration (cloud account login, S3 credentials) so checkSync passes
Defensive patterns
Strategy: validation
Validate before calling
if (!window.siyuan.config.sync.enabled) {
alert("Enable data synchronization first");
return;
} Try / catch
if err := model.SyncDataBeforeEnableEncryptedNotebook(); err != nil {
// treat as feature-not-enabled; guide user to Settings - Sync
} Prevention
- Fully enable data synchronization (not just directory selection) before encrypted-notebook operations
- Ensure no other sync is running when invoking the API
- Verify cloud provider credentials are valid so checkSync passes
When it happens
Trigger: checkSync(false,false,true) returns false during EnableEncryptedNotebookWithSync — typically because sync is disabled at the functional level (Conf.Sync enablement state), the cloud provider is unreachable/configured incompletely, or another sync holds the lock.
Common situations: User toggled a directory but the sync feature itself is off; concurrent sync in progress; incomplete provider credentials cause checkSync to refuse.
Related errors
- The synchronization function can only be activated after…
- Conf.Language(249)
- Conf.Sync.Stat
- AI configuration is unavailable
- Conf.Language(12)
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/90484c684ce14598.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/sync.go:240
}
return
}
func SyncData(byHand bool) {
syncData(false, byHand)
}
// SyncDataBeforeEnableEncryptedNotebook 在启用加密笔记本前执行一次完整同步。
// 未启用数据同步时直接返回;已启用数据同步时,任何同步失败都会阻止继续创建新的密钥体系。
func SyncDataBeforeEnableEncryptedNotebook() error {
if !Conf.Sync.Enabled {
return nil
}
if conf.ProviderS3 != Conf.Sync.Provider && !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() {
syncLock.Lock()
isSyncing.Store(true)
}View on GitHub (pinned to 9f775e8a12)