{"record":{"id":"6c3b5bca448342b5","repo":"siyuan-note/siyuan","slug":"full-manual-mode-requires-push-or-pull-subcomm","errorCode":null,"errorMessage":"full-manual mode requires 'push' or 'pull' subcommand","messagePattern":"full-manual mode requires 'push' or 'pull' subcommand","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/sync.go","lineNumber":35,"sourceCode":"package cmd\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/siyuan-note/siyuan/kernel/conf\"\n\t\"github.com/siyuan-note/siyuan/kernel/model\"\n\n\t\"github.com/spf13/cobra\"\n)\n\nvar syncCmd = &cobra.Command{\n\tUse:   \"sync\",\n\tShort: \"Sync data with cloud\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tif model.Conf.Sync.Mode == 3 {\n\t\t\treturn fmt.Errorf(\"full-manual mode requires 'push' or 'pull' subcommand\")\n\t\t}\n\n\t\tif dryRun {\n\t\t\tfmt.Println(\"[dry-run] Would sync data with cloud\")\n\t\t\treturn nil\n\t\t}\n\n\t\tmodel.SyncData(true)\n\t\tfmt.Println(\"ok\")\n\t\treturn nil\n\t},\n}\n\nvar syncPushCmd = &cobra.Command{\n\tUse:   \"push\",\n\tShort: \"Upload to cloud\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tif dryRun {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/cli/cmd/sync.go#L17-L53","documentation":"Thrown by the bare `sync` cobra command when `model.Conf.Sync.Mode == 3` (full-manual mode). In full-manual mode SiYuan never auto-syncs in either direction — the user must explicitly choose push or pull to avoid accidental overwrites. Calling bare `sync` would be ambiguous, so it is rejected and the operator is redirected to the `push` or `pull` subcommands. The mode is read from `conf.json` (`system.sync.mode`) loaded during `model.InitConf`.","triggerScenarios":"Running `siyuan sync` (no subcommand) while the workspace's `conf.json` has `sync.mode` set to 3. Triggered after switching to full-manual sync mode in the GUI settings.","commonSituations":"User changed sync mode to full-manual in the app settings to prevent auto-sync, then scripted `siyuan sync` expecting bidirectional behavior; CI/automation invoking the bare `sync` command against a workspace configured for manual control.","solutions":["Use an explicit subcommand: `siyuan sync push` to upload or `siyuan sync pull` to download.","If you want bare `sync` to work, switch the mode back to auto/manual (0/1/2) via the GUI settings or by editing `conf.json`."],"exampleFix":"// before\nsiyuan sync\n// after\nsiyuan sync push","handlingStrategy":"validation","validationCode":"// Check sync mode before choosing the command shape.\nif model.Conf.Sync.Mode == 3 {\n    // must use `sync push` or `sync pull` explicitly\n    fmt.Println(\"full-manual mode — use `sync push` or `sync pull`\")\n} else {\n    // `sync` is allowed\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In automation, always use `sync push`/`sync pull` explicitly rather than bare `sync`.","Document the workspace's sync mode so operators know which subcommands are valid.","If scripts must use bare `sync`, ensure mode is 0/1/2."],"tags":["cli","sync","configuration","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}