{"record":{"id":"5f5880ad2967f15a","repo":"clockworklabs/SpacetimeDB","slug":"uproject-dir-is-required-for-lang-unrealcpp","errorCode":null,"errorMessage":"--uproject-dir is required for --lang unrealcpp","messagePattern":"--uproject-dir is required for --lang unrealcpp","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/subcommands/generate.rs","lineNumber":344,"sourceCode":"        let namespace = command_config\n            .get_one::<String>(\"namespace\")?\n            .unwrap_or_else(|| \"SpacetimeDB.Types\".to_string());\n        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,","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/cli/src/subcommands/generate.rs#L326-L362","documentation":"`spacetime generate --lang unrealcpp` produces an Unreal Engine C++ plugin that must live inside a .uproject-containing project, so the CLI validates Unreal-specific arguments up front. If the resolved uproject_dir is None (no --uproject-dir flag and nothing in the generate config), generation refuses to start with this focused error.","triggerScenarios":"Running `spacetime generate --lang unrealcpp` without `--uproject-dir` (and with no `uproject-dir` key in the spacetime.json generate config for this entry). The check runs before module-source validation so the missing Unreal argument is reported first.","commonSituations":"Copying a generate invocation from a Rust/TypeScript project where --uproject-dir doesn't exist; CI pipelines generating UE bindings against a workspace where the uproject path is passed via a variable that is empty; forgetting that unrealcpp has stricter requirements than other languages.","solutions":["Pass the path to your Unreal project directory: `spacetime generate --lang unrealcpp --uproject-dir /path/to/MyProject`","Or persist it in spacetime.json under the generate entry: `\"uproject-dir\": \"../MyProject\"`","Also provide --unreal-module-name at the same time, since it is validated immediately after (error 346)"],"exampleFix":"# before\nspacetime generate --lang unrealcpp --bin-path module.wasm\n# after\nspacetime generate --lang unrealcpp --bin-path module.wasm \\\n  --uproject-dir ~/Projects/MyGame --unreal-module-name MyGame","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nuproject=\"${UPROJECT_DIR:-}\"\n[ -n \"$uproject\" ] && [ -d \"$uproject\" ] || { echo '--uproject-dir <dir> required and must exist'; exit 2; }\nspacetime generate --lang unrealcpp --uproject-dir \"$uproject\" --unreal-module-name \"$MODULE_NAME\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap unrealcpp generation in a script that requires UPROJECT_DIR and MODULE_NAME env vars up front","Store uproject-dir/module-name in the spacetime.json generate entry so manual invocations can't forget them","Remember unrealcpp has stricter requirements than rust/ts/csharp — check args before invoking"],"tags":["cli","generate","unreal","unrealcpp","arguments","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}