{"record":{"id":"0c993c76809afc21","repo":"tursodatabase/turso","slug":"sync-dir-path-does-not-exist-or-is-not-a-directory","errorCode":null,"errorMessage":"sync dir path does not exist or is not a directory: {}","messagePattern":"sync dir path does not exist or is not a directory: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/sync_server.rs","lineNumber":102,"sourceCode":"\n        Ok(Self {\n            address,\n            source: DbSource::Single(Arc::new(DbHandle {\n                conn: Mutex::new(conn),\n                path: db_path,\n            })),\n            interrupt_count,\n        })\n    }\n\n    pub fn new_dir(\n        address: String,\n        base: PathBuf,\n        interrupt_count: Arc<AtomicUsize>,\n        config: OpenConfig,\n    ) -> Result<Self> {\n        if !base.is_dir() {\n            return Err(anyhow!(\n                \"sync dir path does not exist or is not a directory: {}\",\n                base.display()\n            ));\n        }\n        let open_handles = Mutex::new(OpenHandles::new(config.max_open));\n        Ok(Self {\n            address,\n            source: DbSource::Dir {\n                base: base.canonicalize()?,\n                config,\n                open_handles,\n            },\n            interrupt_count,\n        })\n    }\n\n    fn resolve_db(\n        &self,","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/cli/sync_server.rs#L84-L120","documentation":"The sync server's new_dir constructor requires the base path to be an existing directory before it will create server state (open handles etc.). If base.is_dir() is false — the path doesn't exist or is a file — it returns an anyhow error embedding the path.","triggerScenarios":"Starting the sync server with a --path/base directory argument that doesn't exist on disk, or that points to a regular file instead of a directory.","commonSituations":"Typo in the directory path; relying on the server to create the directory (it doesn't — create it yourself); pointing at a database file rather than its containing directory; running from a different working directory so a relative path no longer resolves.","solutions":["Create the directory first: `mkdir -p <path>`.","Verify the path is a directory: `ls -ld <path>`; correct it if it's a file.","Use an absolute path or run from the expected working directory so the relative base resolves.","Fix the CLI flag/config value passed as the sync dir."],"exampleFix":"// before\ntursodb sync-server --path ./does-not-exist\n// after\nmkdir -p ./sync-data && tursodb sync-server --path ./sync-data","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn ensure_sync_dir(base: &Path) -> std::io::Result<()> {\n    if !base.is_dir() {\n        std::fs::create_dir_all(base)?;\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create the sync directory with mkdir -p before starting the server","Pass absolute paths to avoid cwd-dependent resolution","Distinguish database file paths from directory paths in scripts/config"],"tags":["rust","cli","sync-server","path-validation"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"492c4a71cd7c2649e7df83da1471b74f4b1c7aa9","analyzedAt":"2026-09-13T18:13:59.796Z","contentChangedAt":"2026-09-13T18:13:59.796Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}