{"record":{"id":"42c113561518f4e9","repo":"windmill-labs/windmill","slug":"error-getting-type-name-42c113","errorCode":null,"errorMessage":"Error getting type name: {}","messagePattern":"Error getting type name: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-csharp/src/lib.rs","lineNumber":122,"sourceCode":"        \"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        }\n        wc => Err(anyhow!(","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-csharp/src/lib.rs#L104-L140","documentation":"find_typ calls typ_node.utf8_text(code) to read the identifier text of a C# type node; if that utf8 conversion or node access fails (node out of bounds, invalid UTF-8 in the source, corrupted node range), it wraps the underlying tree-sitter error with this message. It is the Err arm of the same match that yields 801.","triggerScenarios":"Calling parse_csharp_sig_meta/parse_csharp_signature on source where the type identifier node's text cannot be extracted as valid UTF-8, or utf8_text returns a tree_sitter error (malformed source bytes, corrupted node range).","commonSituations":"C# script files saved with non-UTF-8 encodings (e.g. Windows-1252) containing non-ASCII characters in type names; truncated or corrupted files; source strings built from invalid byte sequences.","solutions":["Re-save the script file as UTF-8 (e.g. iconv -f WINDOWS-1252 -t UTF-8) and redeploy the script","Inspect the script source for stray binary/corrupted bytes around the type identifier","If the script is stored in the DB, re-edit and re-save its content through the UI/CLI to normalize the encoding"],"exampleFix":"// before\nfile script.cs  # ISO-8859 text\n// after\niconv -f WINDOWS-1252 -t UTF-8 script.cs > fixed.cs\nfile fixed.cs    # UTF-8 Unicode text","handlingStrategy":"validation","validationCode":"// Validate the script is valid UTF-8 before submitting for signature extraction\nfn ensure_utf8(code: &[u8]) -> Result<&str, std::str::Utf8Error> {\n    std::str::from_utf8(code)\n}","typeGuard":null,"tryCatchPattern":"match parse_csharp_sig_meta(&code) {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"Error getting type name\") => {\n        eprintln!(\"encoding/AST extraction failed — check file encoding: {e}\");\n        reencode_and_retry(&code)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Save and deploy scripts as UTF-8 (no BOM); normalize encoding in CI with `file` or `iconv`","Avoid non-ASCII bytes in type names and identifiers","Re-edit scripts through the Windmill UI/CLI rather than re-uploading raw files"],"tags":["csharp","encoding","utf-8","tree-sitter"],"backgroundTag":"invalid-utf8-source","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"}