{"record":{"id":"d915a1bc0e6b1b19","repo":"clockworklabs/SpacetimeDB","slug":"native-aot-is-only-supported-for-c-projects","errorCode":null,"errorMessage":"--native-aot is only supported for C# projects (--lang csharp)","messagePattern":"--native-aot is only supported for C# projects \\(--lang csharp\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/init.rs","lineNumber":1784,"sourceCode":"    }\n\n    let is_interactive = !options.non_interactive;\n    let template = options.template.as_ref();\n    let server_lang = options.lang.as_ref();\n    let project_name_arg = options.project_name.as_ref();\n\n    // Validate that template and lang options are not used together\n    if template.is_some() && server_lang.is_some() {\n        anyhow::bail!(\"Cannot specify both --template and --lang. Language is determined by the template.\");\n    }\n\n    // Validate that --native-aot is only used with C# projects\n    if options.native_aot {\n        if let Some(lang) = server_lang\n            && lang.to_lowercase() != \"csharp\"\n            && lang.to_lowercase() != \"c#\"\n        {\n            anyhow::bail!(\"--native-aot is only supported for C# projects (--lang csharp)\");\n        }\n        // Print warning about Windows-only support\n        println!(\n            \"{}\",\n            \"Note: NativeAOT-LLVM is experimental and building for this platform is currently only supported on Windows.\".yellow()\n        );\n    }\n\n    // Validate that --dotnet-version is only used with C# projects\n    if options.dotnet_version.is_some()\n        && let Some(lang) = server_lang\n        && lang.to_lowercase() != \"csharp\"\n        && lang.to_lowercase() != \"c#\"\n    {\n        anyhow::bail!(\"--dotnet-version is only supported for C# projects (--lang csharp)\");\n    }\n\n    if !is_interactive {","sourceCodeStart":1766,"sourceCodeEnd":1802,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fdd647dfac506d0967cc4492e9fce380706c94cb/crates/cli/src/subcommands/init.rs#L1766-L1802","documentation":"--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.","triggerScenarios":"`spacetime init myapp --lang rust --native-aot` or `--lang typescript --native-aot`; automation that enables AOT for all projects regardless of language.","commonSituations":"Enabling a promising flag globally in scripts; copy-pasting a C#-oriented command and swapping the language; misreading AOT as a generic optimization.","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"],"exampleFix":"# before\nspacetime init myapp --lang rust --native-aot\n# after\nspacetime init myapp --lang rust","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate --native-aot on server language being csharp in your scaffolding scripts","Track that NativeAOT-LLVM building is Windows-only when planning CI"],"tags":["spacetime-init","cli","argument-validation","native-aot","csharp"],"backgroundTag":"unsupported-flag-combination","analyzedSha":"fdd647dfac506d0967cc4492e9fce380706c94cb","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}