clockworklabs/SpacetimeDB · error · anyhow::Error
--native-aot is only supported for C# projects (--lang…
Error message
--native-aot is only supported for C# projects (--lang csharp)
What it means
--native-aot enables experimental NativeAOT-LLVM wasm compilation, which is implemented only for the C# module toolchain. If --lang selects rust or typescript as the server language, init refuses to continue. Note the check only inspects --lang; combined with --template it is skipped, so this fires on the --lang path.
Solutions
- Remove --native-aot when the module is not C#
- Or switch to `--lang csharp` (or `--lang c#`) and keep --native-aot
- Remember AOT builds are currently Windows-only build hosts; plan CI accordingly
Example fix
# before spacetime init myapp --lang rust --native-aot # after spacetime init myapp --lang rust
Defensive patterns
Strategy: validation
Prevention
- Gate --native-aot on server language being csharp in your scaffolding scripts
- Track that NativeAOT-LLVM building is Windows-only when planning CI
When it happens
Trigger: `spacetime init myapp --lang rust --native-aot` or `--lang typescript --native-aot`; automation that enables AOT for all projects regardless of language.
Common situations: Enabling a promising flag globally in scripts; copy-pasting a C#-oriented command and swapping the language; misreading AOT as a generic optimization.
Related errors
- --dotnet-version is only supported for C# projects (--lang…
- Cannot specify both --template and --lang. Language is…
- Could not find StdbModule.csproj at
- Either --template or --lang must be provided in…
- Invalid .csproj file: missing </Project> tag
AI-assisted analysis of clockworklabs/SpacetimeDB@fdd647dfac (2026-08-20).
Data as JSON: /api/errors/d915a1bc0e6b1b19.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/subcommands/init.rs:1784
}
let is_interactive = !options.non_interactive;
let template = options.template.as_ref();
let server_lang = options.lang.as_ref();
let project_name_arg = options.project_name.as_ref();
// Validate that template and lang options are not used together
if template.is_some() && server_lang.is_some() {
anyhow::bail!("Cannot specify both --template and --lang. Language is determined by the template.");
}
// Validate that --native-aot is only used with C# projects
if options.native_aot {
if let Some(lang) = server_lang
&& 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 {View on GitHub (pinned to fdd647dfac)