From 985004bc0e3e4ef27a56b4c5be640dd7b2ba6801 Mon Sep 17 00:00:00 2001 From: "Shibata, Tats" <868951+rewse@users.noreply.github.com> Date: Sun, 22 Mar 2026 12:37:17 +0900 Subject: [PATCH] fix(cli): show actionable error when sync fails due to locked remote DB When the remote database is locked and the CLI device is not in the accepted_nodes list, openReplication returns false with no CLI-specific guidance. The existing log message ('Fetch rebuilt DB, explicit unlocking or chunk clean-up is required') is aimed at the Obsidian plugin UI. Check the replicator's remoteLockedAndDeviceNotAccepted flag after sync failure and print a clear message directing the user to unlock from the Obsidian plugin. Ref: #832 --- src/apps/cli/commands/runCommand.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/apps/cli/commands/runCommand.ts b/src/apps/cli/commands/runCommand.ts index b005acb..fc5d482 100644 --- a/src/apps/cli/commands/runCommand.ts +++ b/src/apps/cli/commands/runCommand.ts @@ -21,6 +21,15 @@ export async function runCommand(options: CLIOptions, context: CLICommandContext if (options.command === "sync") { console.log("[Command] sync"); const result = await core.services.replication.replicate(true); + if (!result) { + const replicator = core.services.replicator.getActiveReplicator(); + if (replicator?.remoteLockedAndDeviceNotAccepted) { + console.error( + `[Error] The remote database is locked and this device is not yet accepted.\n` + + `[Error] Please unlock the database from the Obsidian plugin and retry.` + ); + } + } return !!result; }