windmill-labs/windmill · error

Failed to find inner type of array type

Error message

Failed to find inner type of array type

What it means

When find_typ encounters an `array_type` AST node, it looks up the element type via child_by_field_name("type"). If that child is missing — the parse tree has an array type without an inner type field — it errors with this message. This is a structural AST expectation failure, usually from unusual or malformed C# syntax rather than plain `T[]` declarations.

Source

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

                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!(
            "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())?
        )),
    }
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Fix the array parameter declaration to standard form, e.g. `static void Main(int[] values)`
  2. Verify the tree-sitter-c-sharp crate version matches what windmill-parser-csharp was written for and pin it in Cargo.lock
  3. Simplify the signature to a plain element-typed parameter if the array form keeps failing

Example fix

// before
static void Main(int[])
// after
static void Main(int[] values)
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check: ensure every array parameter is written as `Type[] name`
let re = regex::Regex::new(r"\b\w+\[\]\s+\w+").unwrap();
// a `[]` type with no following identifier in the Main signature must be fixed before parsing

Try / catch

match parse_csharp_sig_meta(code) {
    Ok(m) => m,
    Err(e) if e.to_string().contains("Failed to find inner type of array type") => {
        bail!("malformed array parameter in Main signature — write `T[] name`")
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: parse_csharp_sig_meta on a Main signature whose parameter type produces an array_type node lacking the `type` field: malformed array declarations like `Main(int[])` without a name, or grammar-version differences that change field naming for array types.

Common situations: Hand-edited or truncated C# scripts; using a tree-sitter-c-sharp version whose AST field names differ from what the parser expects; generating signatures from partially written code.

Related errors


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