{"record":{"id":"ab97026fa7544044","repo":"clockworklabs/SpacetimeDB","slug":"unreal-module-name-is-required-for-lang-unreal","errorCode":null,"errorMessage":"--unreal-module-name is required for --lang unrealcpp","messagePattern":"--unreal-module-name is required for --lang unrealcpp","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/generate.rs","lineNumber":348,"sourceCode":"        let module_name = command_config.get_one::<String>(\"unreal_module_name\")?;\n        let module_prefix = command_config.get_one::<String>(\"module_prefix\")?;\n        let build_options = command_config\n            .get_one::<String>(\"build_options\")?\n            .unwrap_or_else(String::new);\n        let dotnet_version = if command_config.is_from_cli(\"dotnet_version\") {\n            command_config.get_one::<u8>(\"dotnet_version\")?\n        } else {\n            let dotnet_version = command_config.get_one::<String>(\"dotnet_version\")?;\n            parse_optional_dotnet_version(dotnet_version.as_deref())?\n        };\n\n        // Validate Unreal-specific args first to preserve focused errors for this mode.\n        if requested_lang == Some(Language::UnrealCpp) {\n            if command_config.get_one::<PathBuf>(\"uproject_dir\")?.is_none() {\n                return Err(anyhow::anyhow!(\"--uproject-dir is required for --lang unrealcpp\"));\n            }\n            if module_name.is_none() {\n                return Err(anyhow::anyhow!(\"--unreal-module-name is required for --lang unrealcpp\"));\n            }\n        }\n\n        // Validate module source path for source-based generation.\n        if wasm_file.is_none() && js_file.is_none() && !project_path.is_dir() {\n            anyhow::bail!(\n                \"Could not find module source at '{}'. \\\n                 If this is not correct, pass --module-path or add module-path in spacetime.json. \\\n                 You can also pass --bin-path/--js-path to generate without building from source.\",\n                project_path.display()\n            );\n        }\n\n        let lang = match requested_lang {\n            Some(lang) => lang,\n            None => {\n                let client_project_dir = config_dir.unwrap_or_else(|| Path::new(\".\"));\n                let detected = detect_default_language(client_project_dir)?;","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/subcommands/generate.rs#L330-L366","documentation":"Unreal C++ codegen writes the generated plugin into a named UE C++ module, so generate requires `--unreal-module-name` (or the `unreal-module-name` config field) whenever `--lang unrealcpp` is used. It is validated immediately after `--uproject-dir`, before any build or generation runs. The name must match a module in your Unreal project's Source layout, not the SpacetimeDB module name.","triggerScenarios":"`spacetime generate --lang unrealcpp --uproject-dir .` without `--unreal-module-name`; an unrealcpp target in spacetime.json lacking the `unreal-module-name` field.","commonSituations":"Following docs that only mention --uproject-dir; assuming the module name defaults to the .uproject name; copy-pasting a rust generate invocation and only changing --lang.","solutions":["Pass `--unreal-module-name <YourUEModule>` using the game/module name from your project's Source directory","Add `\"unreal-module-name\": \"...\"` to the unrealcpp target in spacetime.json","Check your .uproject's Modules list for the exact module name spelling"],"exampleFix":"# before\nspacetime generate --lang unrealcpp --uproject-dir ~/Projects/MyGame\n\n# after\nspacetime generate --lang unrealcpp --uproject-dir ~/Projects/MyGame --unreal-module-name MyGame","handlingStrategy":"validation","validationCode":"# Guard an unrealcpp generate invocation (module name):\nif [[ \"$LANG_ARG\" == \"unrealcpp\" ]]; then\n  [[ -n \"$UE_MODULE\" ]] || { echo \"unrealcpp requires --unreal-module-name\" >&2; exit 2; }\n  [[ -d \"$UPROJECT_DIR/Source/$UE_MODULE\" ]] \\\n    || echo \"WARN: $UPROJECT_DIR/Source/$UE_MODULE does not exist yet\" >&2\nfi\nspacetime generate --lang unrealcpp --uproject-dir \"$UPROJECT_DIR\" --unreal-module-name \"$UE_MODULE\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store `unreal-module-name` in the unrealcpp target of spacetime.json","Use the UE module name from the .uproject Modules list, not the SpacetimeDB module name","Pair --unreal-module-name with --uproject-dir in wrapper scripts so one is never missing"],"tags":["unrealcpp","generate","module-name","missing-flag"],"backgroundTag":"missing-required-flag","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}