clockworklabs/SpacetimeDB · error

v{version} is not installed

Error message

v{version} is not installed

What it means

The `spacetime-install uninstall <version>` subcommand (crates/update/src/cli/uninstall.rs:33) maps the version string to a directory under the CLI bin dir via paths.cli_bin_dir.version_dir(&version) and bails when that directory does not exist. The version must name an actually installed version directory; the literal name `current` and the currently-used version are also refused earlier (lines 18-27).

Source

Thrown at crates/update/src/cli/uninstall.rs:33

impl Uninstall {
    pub(super) fn exec(self, paths: &SpacetimePaths) -> anyhow::Result<()> {
        let Self { version, yes } = self;
        anyhow::ensure!(
            version != BinDir::CURRENT_VERSION_DIR_NAME,
            "cannot remove `current` version"
        );
        match paths
            .cli_bin_dir
            .current_version()
            .context("couldn't read current version")
        {
            Ok(Some(current)) => anyhow::ensure!(version != current, "cannot uninstall currently used version"),
            Ok(None) => {}
            Err(e) => tracing::warn!("{e:#}"),
        }
        let dir = paths.cli_bin_dir.version_dir(&version);
        if !dir.0.exists() {
            anyhow::bail!("v{version} is not installed");
        }
        if yes.confirm(format!("Uninstall v{version}?"))? {
            std::fs::remove_dir_all(&dir)?;
        }
        Ok(())
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use spacetimedb_paths::FromPathUnchecked;
    use spacetimedb_paths::RootDir;

    fn make_temp_paths() -> (tempfile::TempDir, SpacetimePaths) {
        let tmp = tempfile::tempdir().unwrap();
        let base = tmp.path().join("spacetime");
        std::fs::create_dir_all(&base).unwrap();

View on GitHub (pinned to 6dee26c6ef)

Solutions

  1. List the actually installed version directories under the CLI bin dir (the same root spacetime-install manages) and copy the exact version string.
  2. Pass the bare semver directory name, e.g. `spacetime-install uninstall 1.2.3`, matching how the installer created the directory.
  3. If it was already uninstalled, treat the error as success in scripts (idempotent cleanup: check for the directory or tolerate this message).
  4. Verify the tooling resolves the same root you installed into (environment overrides for the SpacetimeDB paths) before uninstalling.

Example fix

# before: version never installed / wrong string form
spacetime-install uninstall v1.2.3   # bails: v1.2.3 is not installed
# after: exact installed version directory name
spacetime-install uninstall 1.2.3
Defensive patterns

Strategy: validation

Validate before calling

// Rust (embedding the update tooling): check before uninstalling.
let dir = paths.cli_bin_dir.version_dir(&version);
if !dir.0.exists() {
    // already gone: make cleanup idempotent
    return Ok(());
}
Uninstall { version, yes: ForceYes { yes: true } }.exec(paths)?;

Try / catch

// In shell scripts, tolerate the already-gone case:
# spacetime-install uninstall "$VER" 2>&1 | grep -q "is not installed" && exit 0

Prevention

When it happens

Trigger: Running `spacetime-install uninstall 9.9.9` (or any version never installed, already removed, or mistyped - note the directory lookup uses the bare version string like `1.2.3`, not a `v` prefix); the update tooling pointed at a different SpacetimeDB root than where the version lives, so version_dir resolves elsewhere.

Common situations: CI cleanup scripts uninstalling a pinned version after a cache wipe already removed it; uninstalling right after a fresh install where the version string was recorded with a `v` prefix or a tag; multiple SPACETIMEDB root directories on one machine.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20). Data as JSON: /api/errors/4ea943f0b8bfa2b8. Report an issue: GitHub.