clockworklabs/SpacetimeDB · error · anyhow::Error

Unknown server language: {}

Error message

Unknown server language: {}

What it means

spacetime init's server language parser accepts, case-insensitively: `rust`, `csharp`, `c#`, `typescript`, `cpp`, `c++`, and `cxx`. Any other string passed via `--lang` (which selects the server language in non-interactive mode) is rejected with this error. Values are lowercased but not trimmed, so stray whitespace also fails.

Source

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

}

impl ServerLanguage {
    fn as_str(&self) -> &'static str {
        match self {
            ServerLanguage::Rust => "rust",
            ServerLanguage::Csharp => "csharp",
            ServerLanguage::TypeScript => "typescript",
            ServerLanguage::Cpp => "cpp",
        }
    }

    fn from_str(s: &str) -> anyhow::Result<Option<Self>> {
        match s.to_lowercase().as_str() {
            "rust" => Ok(Some(ServerLanguage::Rust)),
            "csharp" | "c#" => Ok(Some(ServerLanguage::Csharp)),
            "typescript" => Ok(Some(ServerLanguage::TypeScript)),
            "cpp" | "c++" | "cxx" => Ok(Some(ServerLanguage::Cpp)),
            _ => Err(anyhow!("Unknown server language: {}", s)),
        }
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ClientLanguage {
    Rust,
    Csharp,
    TypeScript,
}

impl ClientLanguage {
    fn as_str(&self) -> &'static str {
        match self {
            ClientLanguage::Rust => "rust",
            ClientLanguage::Csharp => "csharp",
            ClientLanguage::TypeScript => "typescript",
        }

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Use one of: rust, csharp, c#, typescript, cpp, c++, cxx
  2. Check for stray whitespace or quotes around the value in scripts
  3. For stacks without a server template, scaffold manually or use `--template owner/repo` with your own repo

Example fix

# before
spacetime init my-app --non-interactive --lang c-sharp

# after
spacetime init my-app --non-interactive --lang csharp
Defensive patterns

Strategy: validation

Validate before calling

# Validate the server language before calling init:
case "${LANG_ARG,,}" in
  rust|csharp|c#|typescript|cpp|c++|cxx) ;;
  *) echo "unsupported server language: $LANG_ARG" >&2; exit 2 ;;
esac
spacetime init --non-interactive --project-name my-app --lang "$LANG_ARG"

Type guard

// Rust: matches init's ServerLanguage::from_str acceptance set.
fn is_supported_server_lang(s: &str) -> bool {
    matches!(
        s.trim().to_lowercase().as_str(),
        "rust" | "csharp" | "c#" | "typescript" | "cpp" | "c++" | "cxx"
    )
}

Prevention

When it happens

Trigger: `spacetime init --lang python`, `--lang go`, or `--lang unrealcpp` (client-only, not a server language); a shell variable with trailing whitespace or quotes; misspellings like `c-sharp` or `typescriptjs`.

Common situations: Assuming an unsupported server language exists; passing a client language where the server language is expected; unquoted/over-quoted variables in scripts.

Related errors


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