clockworklabs/SpacetimeDB · error · anyhow::Error

--dotnet-version is only supported for C# projects (--lang…

Error message

--dotnet-version is only supported for C# projects (--lang csharp)

What it means

--dotnet-version pins the .NET SDK/framework (8 or 10) used for C# module projects, so it is validated against --lang: passing it together with --lang rust or --lang typescript aborts init. Like the --native-aot check, it only fires when --lang is explicitly given.

Solutions

  1. Remove --dotnet-version for non-C# projects
  2. Or use `--lang csharp --dotnet-version 8|10`

Example fix

# before
spacetime init myapp --lang rust --dotnet-version 10
# after
spacetime init myapp --lang rust
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: `spacetime init myapp --lang rust --dotnet-version 10`; scripts that always pass --dotnet-version regardless of language.

Common situations: Template command lines reused across language choices; CI defaults injecting extra flags.

Related errors


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

Appendix: source

Thrown at crates/cli/src/subcommands/init.rs:1799

            && lang.to_lowercase() != "csharp"
            && lang.to_lowercase() != "c#"
        {
            anyhow::bail!("--native-aot is only supported for C# projects (--lang csharp)");
        }
        // Print warning about Windows-only support
        println!(
            "{}",
            "Note: NativeAOT-LLVM is experimental and building for this platform is currently only supported on Windows.".yellow()
        );
    }

    // Validate that --dotnet-version is only used with C# projects
    if options.dotnet_version.is_some()
        && let Some(lang) = server_lang
        && lang.to_lowercase() != "csharp"
        && lang.to_lowercase() != "c#"
    {
        anyhow::bail!("--dotnet-version is only supported for C# projects (--lang csharp)");
    }

    if !is_interactive {
        // In non-interactive mode, validate all required args are present
        if project_name_arg.is_none() {
            anyhow::bail!("PROJECT_NAME is required in non-interactive mode");
        }
        if template.is_none() && server_lang.is_none() {
            anyhow::bail!("Either --template or --lang must be provided in non-interactive mode");
        }
    }

    exec_with_options(&mut config, &options).await
}

pub fn init_rust_project(project_path: &Path) -> anyhow::Result<()> {
    let export_files = vec![
        (

View on GitHub (pinned to fdd647dfac)