{"record":{"id":"0bca1728625ce1e9","repo":"windmill-labs/windmill","slug":"type-not-found-for-argument","errorCode":null,"errorMessage":"Type not found for argument {}","messagePattern":"Type not found for argument (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/csharp_executor.rs","lineNumber":277,"sourceCode":"\n    write_file(job_dir, \"Script.cs\", code.as_str())?;\n\n    let sig_meta = windmill_parser_csharp::parse_csharp_sig_meta(code.as_str())?;\n    let sig = sig_meta.main_sig;\n    let spread = &sig\n        .args\n        .clone()\n        .into_iter()\n        .map(|x| format!(\"parsedArgs.{}\", &x.name))\n        .join(\", \");\n    let args_class_body = &sig\n        .args\n        .into_iter()\n        .map(|x| {\n            Ok(format!(\n                \"        public {} {} {{ get; set; }}\",\n                x.otyp\n                    .ok_or(anyhow!(\"Type not found for argument {}\", x.name))?,\n                &x.name,\n            ))\n        })\n        .collect::<Result<Vec<String>, anyhow::Error>>()?\n        .join(\"\\n\");\n\n    let class_name = sig_meta.class_name.unwrap_or(\"Script\".to_string());\n\n    let script_call = match (sig_meta.is_async, sig_meta.returns_void) {\n        (true, true) => format!(\n            r#\"\n            {class_name}.Main({spread}).Wait();\n            File.WriteAllText(\"result.json\", \"null\");\n            \"#\n        ),\n        (false, true) => format!(\n            r#\"\n            {class_name}.Main({spread});","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/csharp_executor.rs#L259-L295","documentation":"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.","triggerScenarios":"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.","commonSituations":"Scripts edited directly via API/CLI with otyp omitted; older scripts predating type metadata; copy-pasted script definitions missing 'typ' fields.","solutions":["Edit the script in the Windmill UI and set an explicit type for the offending argument","Check the wrapped message for the argument name and fix its definition in the script's JSON schema","Re-save/redeploy the script so otyp is populated, then re-run the job"],"exampleFix":"// before\n{\"name\": \"count\", \"typ\": null}\n// after\n{\"name\": \"count\", \"typ\": {\"type\": \"integer\"}}","handlingStrategy":"validation","validationCode":"for (const a of script.args) {\n  if (!a.typ) throw new Error(`Argument '${a.name}' is missing a type`);\n}","typeGuard":"function hasTypedArgs(script: { args: { name: string; typ?: unknown }[] }): boolean {\n  return script.args.every(a => a.typ != null);\n}","tryCatchPattern":null,"preventionTips":["Always edit script arguments via the UI so typ is set","Validate script JSON before API/CLI deploys","Migrate old scripts lacking type metadata"],"tags":["csharp","schema-validation","codegen"],"backgroundTag":"missing-argument-type","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}