windmill-labs/windmill · error

Type not found for argument {}

Error message

Type not found for argument {}

What it means

When generating the .csproj args class, every script argument must have a known C# type (otyp). If an argument's type is missing from the script's argument schema, code generation cannot emit the property and fails with this message.

Source

Thrown at backend/windmill-worker/src/csharp_executor.rs:277

    write_file(job_dir, "Script.cs", code.as_str())?;

    let sig_meta = windmill_parser_csharp::parse_csharp_sig_meta(code.as_str())?;
    let sig = sig_meta.main_sig;
    let spread = &sig
        .args
        .clone()
        .into_iter()
        .map(|x| format!("parsedArgs.{}", &x.name))
        .join(", ");
    let args_class_body = &sig
        .args
        .into_iter()
        .map(|x| {
            Ok(format!(
                "        public {} {} {{ get; set; }}",
                x.otyp
                    .ok_or(anyhow!("Type not found for argument {}", x.name))?,
                &x.name,
            ))
        })
        .collect::<Result<Vec<String>, anyhow::Error>>()?
        .join("\n");

    let class_name = sig_meta.class_name.unwrap_or("Script".to_string());

    let script_call = match (sig_meta.is_async, sig_meta.returns_void) {
        (true, true) => format!(
            r#"
            {class_name}.Main({spread}).Wait();
            File.WriteAllText("result.json", "null");
            "#
        ),
        (false, true) => format!(
            r#"
            {class_name}.Main({spread});

View on GitHub (pinned to e474e8803c)

Solutions

  1. Edit the script in the Windmill UI and set an explicit type for the offending argument
  2. Check the wrapped message for the argument name and fix its definition in the script's JSON schema
  3. Re-save/redeploy the script so otyp is populated, then re-run the job

Example fix

// before
{"name": "count", "typ": null}
// after
{"name": "count", "typ": {"type": "integer"}}
Defensive patterns

Strategy: validation

Validate before calling

for (const a of script.args) {
  if (!a.typ) throw new Error(`Argument '${a.name}' is missing a type`);
}

Type guard

function hasTypedArgs(script: { args: { name: string; typ?: unknown }[] }): boolean {
  return script.args.every(a => a.typ != null);
}

Prevention

When it happens

Trigger: A C# script was saved with an argument lacking a valid type (e.g. type stripped by an import/API deploy, or a type unsupported/unmapped in the schema), then a job/prebuild tries to compile it.

Common situations: Scripts edited directly via API/CLI with otyp omitted; older scripts predating type metadata; copy-pasted script definitions missing 'typ' fields.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/0bca1728625ce1e9. Report an issue: GitHub.