clockworklabs/SpacetimeDB · error · anyhow::Error

For some reason, your project has both a `bin` and a `bin~`

Error message

For some reason, your project has both a `bin` and a `bin~` folder.
I don't know which to use, so please delete both and rerun this command so that we can see which is up-to-date.

What it means

Error "For some reason, your project has both a `bin` and a `bin~` folder. I don't know which to use, so please delete both and rerun this command so that we can see which is up-to-date." thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/cli/src/tasks/csharp.rs:455

        )),
        // NativeAOT-LLVM outputs to 'native' subdirectory instead of 'publish'
        project_path.join(format!(
            "bin/{config_name}/{target_framework}/wasi-wasm/{subdir}/StdbModule.wasm"
        )),
        project_path.join(format!(
            "bin~/{config_name}/{target_framework}/wasi-wasm/{subdir}/StdbModule.wasm"
        )),
        // Also check for raw wasm output without wasi-wasm RID folder (NativeAOT-LLVM sometimes does this)
        project_path.join(format!("bin/{config_name}/{target_framework}/native/StdbModule.wasm")),
        project_path.join(format!("bin~/{config_name}/{target_framework}/native/StdbModule.wasm")),
    ];
    // Check if both bin and bin~ variants exist for the same output path (indicates a conflict)
    for i in (0..possible_output_paths.len()).step_by(2) {
        if i + 1 < possible_output_paths.len() {
            let bin_path = &possible_output_paths[i];
            let bin_tilde_path = &possible_output_paths[i + 1];
            if bin_path.exists() && bin_tilde_path.exists() {
                anyhow::bail!(concat!(
                    "For some reason, your project has both a `bin` and a `bin~` folder.\n",
                    "I don't know which to use, so please delete both and rerun this command so that we can see which is up-to-date."
                ));
            }
        }
    }
    for output_path in &possible_output_paths {
        if output_path.exists() {
            return Ok(output_path.clone());
        }
    }

    // Diagnostic: list what we expected and what actually exists in the output directories
    eprintln!("Build path: {build_path:?}, target_framework: {target_framework}, subdir: {subdir}");
    eprintln!("Expected output in one of:");
    for p in &possible_output_paths {
        eprintln!("  {}", p.display());
    }

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/cli/src/tasks/csharp.rs:455 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/709491eef9459a63. Report an issue: GitHub.