windmill-labs/windmill · error

Unexpected C# type node kind: {} for '{}'. This type is not

Error message

Unexpected C# type node kind: {} for '{}'. This type is not handeled by Windmill, please open an issue if this seems to be an error

What it means

This is find_typ's catch-all: any C# type node kind not explicitly handled (e.g. tuple_type, function_pointer_type, ref_type) produces this error, telling the user the type is not handled by Windmill and to open an issue. It is an intentional unsupported-feature rejection, not a crash.

Source

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

                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!(
            "Unexpected C# type node kind: {} for '{}'. This type is not handeled by Windmill, please open an issue if this seems to be an error",
            wc,
            typ_node.utf8_text(code.as_bytes())?
        )),
    }
}

fn parse_csharp_typ<'a>(
    param_node: Node<'a>,
    code: &str,
) -> anyhow::Result<(Option<String>, Typ, String)> {
    let name = param_node
        .child_by_field_name("name")
        .and_then(|n| n.utf8_text(code.as_bytes()).ok())
        .unwrap_or("");
    let otyp_node = param_node.child_by_field_name("type");
    let otyp = otyp_node
        .and_then(|n| n.utf8_text(code.as_bytes()).ok())

View on GitHub (pinned to e474e8803c)

Solutions

  1. Rewrite the parameter using a supported type: primitives, arrays of them, generic_name (maps to Unknown), or object
  2. Replace tuple/ref/out parameters with a single object or array parameter and unpack inside the body
  3. Remove `ref`/`out`/`in` modifiers from Main parameters
  4. Open a Windmill issue if the type seems like it should be supported, as the message requests

Example fix

// before
static void Main((int Id, string Name) item)
// after
static void Main(object item) // pass as object/JSON and unpack in body
Defensive patterns

Strategy: type-guard

Validate before calling

// Restrict signature parameter types to constructs the parser handles:
// predefined primitives, identifier, generic_name, array_type, pointer_type, nullable_type.
// Anything else (tuples, ref/out, function pointers) must be rewritten before deploy.

Type guard

fn signature_node_kind_supported(kind: &str) -> bool {
    matches!(kind,
        "predefined_type" | "identifier" | "generic_name" | "array_type"
        | "pointer_type" | "nullable_type")
}

Try / catch

match parse_csharp_signature(code) {
    Ok(sig) => sig,
    Err(e) if e.to_string().contains("Unexpected C# type node kind") => {
        // surface which kind failed so the author can rewrite the parameter
        bail!("rewrite main-signature parameter: {e}")
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: parse_csharp_sig_meta on a Main signature whose parameter type compiles to an unhandled AST kind: tuple parameters `(int a, string b)`, function pointers, `ref`/`out`/`in` modifiers producing ref_type nodes, nested generic constructs the grammar kinds differently.

Common situations: Authors writing idiomatic modern C# (tuples, records, spans, function pointers) in a Windmill script; ref/out parameters on Main; copying library-style signatures into Windmill.

Related errors


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