{"record":{"id":"81a786b21353f192","repo":"windmill-labs/windmill","slug":"unknown-type-s-81a786","errorCode":null,"errorMessage":"Unknown type `{s}`","messagePattern":"Unknown type `(.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-csharp/src/lib.rs","lineNumber":121,"sourceCode":"    match typ_node.kind() {\n        \"predefined_type\" => {\n            match typ_node.utf8_text(code.as_bytes()) {\n                Ok(\"string\") => Ok(Typ::Str(None)),\n                Ok(\"sbyte\") | Ok(\"System.SByte\") => Ok(Typ::Bytes),\n                Ok(\"byte\") | Ok(\"System.Byte\") => Ok(Typ::Bytes),\n                Ok(\"short\") | Ok(\"System.Int16\") => Ok(Typ::Int),\n                Ok(\"ushort\") | Ok(\"System.UInt16\") => Ok(Typ::Int),\n                Ok(\"int\") | Ok(\"System.Int32\") => Ok(Typ::Int),\n                Ok(\"uint\") | Ok(\"System.UInt32\") => Ok(Typ::Int),\n                Ok(\"long\") | Ok(\"System.Int64\") => Ok(Typ::Int),\n                Ok(\"ulong\") | Ok(\"System.UInt64\") => Ok(Typ::Int),\n                Ok(\"char\") | Ok(\"System.Char\") => Ok(Typ::Str(None)),\n                Ok(\"float\") | Ok(\"System.Single\") => Ok(Typ::Float),\n                Ok(\"double\") | Ok(\"System.Double\") => Ok(Typ::Float),\n                Ok(\"bool\") | Ok(\"System.Boolean\") => Ok(Typ::Bool),\n                Ok(\"decimal\") | Ok(\"System.Decimal\") => Ok(Typ::Float),\n                Ok(\"object\") => Ok(Typ::Object(ObjectType::new(None, Some(vec![])))), // TODO: Complete the object type\n                Ok(s) => Err(anyhow!(\"Unknown type `{s}`\")),\n                Err(e) => Err(anyhow!(\"Error getting type name: {}\", e)),\n            }\n        }\n        \"array_type\" => {\n            let new_typ_node = typ_node\n                .child_by_field_name(\"type\")\n                .ok_or(anyhow!(\"Failed to find inner type of array type\"))?;\n            Ok(Typ::List(Box::new(find_typ(new_typ_node, code)?)))\n        }\n        \"identifier\" => Ok(Typ::Unknown),\n        \"generic_name\" => Ok(Typ::Unknown),\n        \"pointer_type\" => Ok(Typ::Int),\n        \"nullable_type\" => {\n            let new_typ_node = typ_node\n                .child_by_field_name(\"type\")\n                .ok_or(anyhow!(\"Failed to find inner type of nullable_type\"))?;\n            Ok(find_typ(new_typ_node, code)?)\n        }","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-csharp/src/lib.rs#L103-L139","documentation":"find_typ maps C# type AST nodes to Windmill parameter types. When the node is an identifier whose text matches none of the whitelisted primitive/BCL types (int, string, char, float, double, bool, decimal, object and their System.* equivalents), it rejects it with this error. Windmill only supports a fixed set of C# types for main-function signatures; any custom or unrecognized type name is refused.","triggerScenarios":"A C# script whose `static void Main(...)` declares a parameter with a type that is not in the whitelist: custom classes, enums, structs, type aliases like `uint`, `long`, `short`, `byte`, `Int64`, `DateTime`, `Guid`, etc.","commonSituations":"Writing a Windmill C# script with `long count`, `uint id`, `DateTime start`, `Guid orderId`, `MyEnum status`; copy-pasting normal C# code into Windmill without adapting signature types to the supported set.","solutions":["Change the main-signature parameter to a supported type: int, string, char, float, double, bool, decimal, object, or an array/list of those","For custom types, accept `object` in the signature and deserialize inside the script body","If the type is a common alias (uint, long, ulong, short, byte), extend the match arms in find_typ to map it to an existing Typ","File an issue upstream if you believe the type should be supported"],"exampleFix":"// before\nstatic void Main(long count)\n// after\nstatic void Main(int count)","handlingStrategy":"validation","validationCode":"// Pre-check main-signature parameter types against the supported set before deploying\nconst SUPPORTED: &[&str] = &[\"int\",\"string\",\"char\",\"float\",\"double\",\"bool\",\"decimal\",\"object\",\"System.Int32\",\"System.String\",\"System.Char\",\"System.Single\",\"System.Double\",\"System.Boolean\",\"System.Decimal\"];\nfn unsupported_types(main_params: &[&str]) -> Vec<&str> {\n    main_params.iter().filter(|t| !SUPPORTED.contains(t)).cloned().collect()\n}","typeGuard":"fn is_supported_cs_type(t: &str) -> bool {\n    matches!(t, \"int\" | \"string\" | \"char\" | \"float\" | \"double\" | \"bool\" | \"decimal\" | \"object\"\n        | \"System.Int32\" | \"System.String\" | \"System.Char\" | \"System.Single\"\n        | \"System.Double\" | \"System.Boolean\" | \"System.Decimal\")\n}","tryCatchPattern":"match parse_csharp_signature(code) {\n    Ok(sig) => sig,\n    Err(e) if e.to_string().starts_with(\"Unknown type\") => {\n        // degrade gracefully: fall back to a default signature instead of failing deploy\n        Ok(MainArgSignature::default())\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Restrict Windmill C# main parameters to the whitelisted primitive/BCL types","Use `object` for anything richer and parse/deserialize inside the script body","Expand numeric aliases (use int, not uint/long/short) before writing the signature","Test signature extraction locally with parse_csharp_signature before deploying"],"tags":["csharp","type-mapping","parser"],"backgroundTag":"unsupported-type-signature","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"}