windmill-labs/windmill · error

Error getting type name: {}

Error message

Error getting type name: {}

What it means

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.

Source

Thrown at backend/parsers/windmill-parser-csharp/src/lib.rs:122

        "predefined_type" => {
            match typ_node.utf8_text(code.as_bytes()) {
                Ok("string") => Ok(Typ::Str(None)),
                Ok("sbyte") | Ok("System.SByte") => Ok(Typ::Bytes),
                Ok("byte") | Ok("System.Byte") => Ok(Typ::Bytes),
                Ok("short") | Ok("System.Int16") => Ok(Typ::Int),
                Ok("ushort") | Ok("System.UInt16") => Ok(Typ::Int),
                Ok("int") | Ok("System.Int32") => Ok(Typ::Int),
                Ok("uint") | Ok("System.UInt32") => Ok(Typ::Int),
                Ok("long") | Ok("System.Int64") => Ok(Typ::Int),
                Ok("ulong") | Ok("System.UInt64") => Ok(Typ::Int),
                Ok("char") | Ok("System.Char") => Ok(Typ::Str(None)),
                Ok("float") | Ok("System.Single") => Ok(Typ::Float),
                Ok("double") | Ok("System.Double") => Ok(Typ::Float),
                Ok("bool") | Ok("System.Boolean") => Ok(Typ::Bool),
                Ok("decimal") | Ok("System.Decimal") => Ok(Typ::Float),
                Ok("object") => Ok(Typ::Object(ObjectType::new(None, Some(vec![])))), // TODO: Complete the object type
                Ok(s) => Err(anyhow!("Unknown type `{s}`")),
                Err(e) => Err(anyhow!("Error getting type name: {}", e)),
            }
        }
        "array_type" => {
            let new_typ_node = typ_node
                .child_by_field_name("type")
                .ok_or(anyhow!("Failed to find inner type of array type"))?;
            Ok(Typ::List(Box::new(find_typ(new_typ_node, code)?)))
        }
        "identifier" => Ok(Typ::Unknown),
        "generic_name" => Ok(Typ::Unknown),
        "pointer_type" => Ok(Typ::Int),
        "nullable_type" => {
            let new_typ_node = typ_node
                .child_by_field_name("type")
                .ok_or(anyhow!("Failed to find inner type of nullable_type"))?;
            Ok(find_typ(new_typ_node, code)?)
        }
        wc => Err(anyhow!(

View on GitHub (pinned to e474e8803c)

Solutions

  1. Re-save the script file as UTF-8 (e.g. iconv -f WINDOWS-1252 -t UTF-8) and redeploy the script
  2. Inspect the script source for stray binary/corrupted bytes around the type identifier
  3. If the script is stored in the DB, re-edit and re-save its content through the UI/CLI to normalize the encoding

Example fix

// before
file script.cs  # ISO-8859 text
// after
iconv -f WINDOWS-1252 -t UTF-8 script.cs > fixed.cs
file fixed.cs    # UTF-8 Unicode text
Defensive patterns

Strategy: validation

Validate before calling

// Validate the script is valid UTF-8 before submitting for signature extraction
fn ensure_utf8(code: &[u8]) -> Result<&str, std::str::Utf8Error> {
    std::str::from_utf8(code)
}

Try / catch

match parse_csharp_sig_meta(&code) {
    Ok(m) => m,
    Err(e) if e.to_string().contains("Error getting type name") => {
        eprintln!("encoding/AST extraction failed — check file encoding: {e}");
        reencode_and_retry(&code)
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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