clockworklabs/SpacetimeDB · error · anyhow::Error
Unknown client language
Error message
Unknown client language: {} What it means
Client-language counterpart of the server-language parser in `spacetime init`. ClientLanguage::from_str accepts only rust, csharp (alias c#), and typescript — note there is NO cpp/client option, and values like 'unrealcpp', 'javascript', or 'ts' are rejected with 'Unknown client language: <s>'.
Solutions
- Use exactly rust, csharp (or c#), or typescript
- If you need Unreal C++ client bindings, init with a supported client language (or none) and run `spacetime generate --lang unrealcpp` separately
- Normalize values in automation: lowercase, expand 'ts'→'typescript'
Example fix
# before spacetime init --client-lang ts # after spacetime init --client-lang typescript
Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash
CLIENT_LANGS='rust|csharp|c#|typescript'
lang="$(echo "$1" | tr '[:upper:]' '[:lower:]' | xargs)"
[[ "$lang" =~ ^($CLIENT_LANGS)$ ]] || { echo "client lang must be: $CLIENT_LANGS (no ts/javascript/unrealcpp)" >&2; exit 2; }
spacetime init --client-lang "$lang" Prevention
- Client languages are a smaller set than server languages — 'ts' and 'unrealcpp' are NOT accepted
- For Unreal client bindings, init without them and run `spacetime generate --lang unrealcpp` separately
- Don't reuse one shell variable for both --lang and --client-lang; their accepted sets differ
When it happens
Trigger: Passing `spacetime init --client-lang <s>` with a value outside {rust, csharp, c#, typescript}. Common misses: 'ts' (not an alias), 'javascript' (not an alias), 'unrealcpp' (not a client language for init templates).
Common situations: Mapping 'typescript'→'ts' out of habit; Unity/Unreal developers trying 'unrealcpp' as a client language; scripts sharing one language variable between server and client flags where the server accepts cpp but the client parser does not.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown server language
- Either --out-dir or --uproject-dir is required
- --namespace is only supported with --lang csharp
- --unreal-module-name is required for --lang unrealcpp
- --uproject-dir is required for --lang unrealcpp
AI-assisted analysis of clockworklabs/SpacetimeDB@fdd647dfac (2026-08-20).
Data as JSON: /api/errors/71e8cfab8d3e873e.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/subcommands/init.rs:106
Csharp,
TypeScript,
}
impl ClientLanguage {
fn as_str(&self) -> &'static str {
match self {
ClientLanguage::Rust => "rust",
ClientLanguage::Csharp => "csharp",
ClientLanguage::TypeScript => "typescript",
}
}
fn from_str(s: &str) -> anyhow::Result<Option<Self>> {
match s.to_lowercase().as_str() {
"rust" => Ok(Some(ClientLanguage::Rust)),
"csharp" | "c#" => Ok(Some(ClientLanguage::Csharp)),
"typescript" => Ok(Some(ClientLanguage::TypeScript)),
_ => Err(anyhow!("Unknown client language: {}", s)),
}
}
}
pub struct TemplateConfig {
pub project_name: String,
pub project_path: PathBuf,
pub template_type: TemplateType,
pub server_lang: Option<ServerLanguage>,
pub client_lang: Option<ClientLanguage>,
pub github_repo: Option<String>,
pub template_def: Option<TemplateDefinition>,
pub use_local: bool,
pub native_aot: bool,
}
#[derive(Debug, Clone, Default)]
pub struct InitOptions {View on GitHub (pinned to fdd647dfac)