FyroxEngine/Fyrox · error

unknown target platform

Error message

unknown target platform {}!

What it means

ExportOptions construction parses the --target-platform CLI argument and only accepts "android", "pc", or "wasm"; any other string panics. The exporter needs a concrete platform to configure the build, and unknown values indicate a typo or an unsupported platform.

Solutions

  1. Set --target-platform to one of: android, pc, wasm (exact lowercase spelling).
  2. Check your build/export script or CI configuration for the correct value.
  3. If you need another platform, patch the match in fyrox-build-tools/src/export/mod.rs to map it to a new TargetPlatform variant.

Example fix

// before
mygame --export --target-platform Windows
// after
mygame --export --target-platform pc
Defensive patterns

Strategy: validation

Validate before calling

const VALID: [&str; 3] = ["android", "pc", "wasm"];
if !VALID.contains(&args.target_platform.as_ref()) {
    eprintln!("--target-platform must be one of {:?}", VALID);
    std::process::exit(2);
}

Type guard

fn is_valid_platform(p: &str) -> bool {
    matches!(p, "android" | "pc" | "wasm")
}

Prevention

When it happens

Trigger: Running the exporter (build_tools export) with --target-platform set to anything other than exactly "android", "pc", or "wasm" (case-sensitive).

Common situations: Typo in the CLI flag value ("Android", "windows", "web", "wasm32"); outdated scripts referencing a removed platform name; copy-pasted command from another project.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10). Data as JSON: /api/errors/6c8eda4e373b26d6. Report an issue: GitHub.

Appendix: source

Thrown at fyrox-build-tools/src/export/mod.rs:341

    /// version. For example, native game scenes and UIs will be converted from ASCII to binary
    /// if this option is specified.
    #[clap(short, long, default_value = "true")]
    pub convert_assets: bool,

    /// If specified, enables all possible optimizations for the build.
    #[clap(short, long, default_value = "true")]
    pub enable_optimization: bool,
}

pub fn cli_export(resource_manager: ResourceManager) {
    let args = CliExportOptions::parse();

    let options = ExportOptions {
        target_platform: match args.target_platform.as_ref() {
            "android" => TargetPlatform::Android,
            "pc" => TargetPlatform::PC,
            "wasm" => TargetPlatform::WebAssembly,
            _ => panic!("unknown target platform {}!", args.target_platform),
        },
        destination_folder: args.destination_folder,
        include_used_assets: args.include_used_assets,
        assets_folders: args.assets_folders,
        ignored_extensions: args.ignored_extensions,
        build_target: args.build_target,
        run_after_build: args.run_after_build,
        open_destination_folder: args.open_destination_folder,
        convert_assets: args.convert_assets,
        enable_optimization: args.enable_optimization,
    };

    export(options, Default::default(), resource_manager).unwrap();
}

View on GitHub (pinned to 76c91aad8e)