tursodatabase/turso · error

sync dir path does not exist or is not a directory: {}

Error message

sync dir path does not exist or is not a directory: {}

What it means

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.

Source

Thrown at cli/sync_server.rs:102

        Ok(Self {
            address,
            source: DbSource::Single(Arc::new(DbHandle {
                conn: Mutex::new(conn),
                path: db_path,
            })),
            interrupt_count,
        })
    }

    pub fn new_dir(
        address: String,
        base: PathBuf,
        interrupt_count: Arc<AtomicUsize>,
        config: OpenConfig,
    ) -> Result<Self> {
        if !base.is_dir() {
            return Err(anyhow!(
                "sync dir path does not exist or is not a directory: {}",
                base.display()
            ));
        }
        let open_handles = Mutex::new(OpenHandles::new(config.max_open));
        Ok(Self {
            address,
            source: DbSource::Dir {
                base: base.canonicalize()?,
                config,
                open_handles,
            },
            interrupt_count,
        })
    }

    fn resolve_db(
        &self,

View on GitHub (pinned to 492c4a71cd)

Solutions

  1. Create the directory first: `mkdir -p <path>`.
  2. Verify the path is a directory: `ls -ld <path>`; correct it if it's a file.
  3. Use an absolute path or run from the expected working directory so the relative base resolves.
  4. Fix the CLI flag/config value passed as the sync dir.

Example fix

// before
tursodb sync-server --path ./does-not-exist
// after
mkdir -p ./sync-data && tursodb sync-server --path ./sync-data
Defensive patterns

Strategy: validation

Validate before calling

use std::path::Path;
fn ensure_sync_dir(base: &Path) -> std::io::Result<()> {
    if !base.is_dir() {
        std::fs::create_dir_all(base)?;
    }
    Ok(())
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13). Data as JSON: /api/errors/0c993c76809afc21. Report an issue: GitHub.