siyuan-note/siyuan · error

Conf.Language(53)

Error message

Conf.Language(53)

What it means

In SyncDataBeforeEnableEncryptedNotebook, if checkSync(false, false, true) returns false, the function returns Conf.Language(53) = 'Data synchronization has not been enabled'. checkSync validates sync preconditions (enabled, provider configured, not already syncing, etc.); passing false here means the environment is not in a syncable state even though Conf.Sync.Enabled appeared true earlier in the function.

Source

Thrown at kernel/model/sync.go:232

	}
	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() {
	syncLock.Lock()
	isSyncing.Store(true)
}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Complete the sync provider setup in Settings - Cloud (S3/WebDAV/Local credentials, endpoint, path).
  2. Wait for any in-progress sync to finish, then retry enabling encryption.
  3. If unsure, run a manual sync (Settings - Sync now) first; if that succeeds, retry the enable.

Example fix

// no code change; runtime precondition
// before: enable encryption while sync provider unconfigured -> error 53
// after: configure provider, run Sync now, then enable encryption
Defensive patterns

Strategy: validation

Validate before calling

// Go: before enabling encryption, ensure a sync will actually run
if !checkSync(false, false, true) {
    return errors.New("finish sync provider setup, then enable encryption")
}

Type guard

// Go
func syncRunnable() bool { return checkSync(false, false, true) }

Prevention

When it happens

Trigger: checkSync returns false because the sync provider is not fully configured (missing S3/WebDAV/Local credentials), another sync is in flight and locked, or an internal precondition failed. Fires during the encryption-enable flow only when sync is nominally on but not actually runnable.

Common situations: User enabled sync in config but never completed provider setup (no S3 keys / WebDAV URL). A background sync is mid-flight and holds syncLock. Provider was switched to one whose config is incomplete.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/179c56db31cdc343. Report an issue: GitHub.