{"record":{"id":"05d6f1d344a73488","repo":"windmill-labs/windmill","slug":"failed-to-find-inner-type-of-array-type-05d6f1","errorCode":null,"errorMessage":"Failed to find inner type of array type","messagePattern":"Failed to find inner type of array type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-java/src/lib.rs","lineNumber":145,"sourceCode":"        \"floating_point_type\" => {\n            match typ_node.utf8_text(code.as_bytes()) {\n                Ok(\"float\") => (Typ::Float, None),\n                Ok(\"double\") => (Typ::Float, None),\n                Ok(s) => bail!(\"Unknown type `{s}`\"),\n                Err(e) => bail!(\"Error getting type name: {}\", e),\n            }\n        }\n        \"boolean_type\" => {\n            match typ_node.utf8_text(code.as_bytes()) {\n                Ok(\"boolean\") => (Typ::Bool, None),\n                Ok(s) => bail!(\"Unknown type `{s}`\"),\n                Err(e) => bail!(\"Error getting type name: {}\", e),\n            }\n        }\n        \"array_type\" => {\n            let new_typ_node = typ_node\n                .named_child(0)\n                .ok_or(anyhow!(\"Failed to find inner type of array type\"))?;\n            (Typ::List(Box::new(find_typ(new_typ_node, code)?.0)), null)\n        }\n        wc => bail!(\n            \"Unexpected Java type node kind: {} for '{}'. This type is not handled by Windmill, please open an issue if this seems to be an error\",\n            wc,\n            typ_node.utf8_text(code.as_bytes())?\n        ),\n\n    };\n    Ok(res)\n}\n\nfn parse_java_typ<'a>(\n    param_node: Node<'a>,\n    code: &str,\n) -> anyhow::Result<(Option<String>, Typ, String, Option<Value>)> {\n    let name = param_node\n        .child_by_field_name(\"name\")","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-java/src/lib.rs#L127-L163","documentation":"Raised by find_typ when it encounters an `array_type` AST node whose element type is missing: `named_child(0)` returned None, meaning the array node has no named child to recurse into. tree-sitter's Java grammar normally always attaches the element type as the named child of an array_type, so this is an internal invariant violation — it fires only on a malformed/ERROR-recovered node where the element type could not be parsed.","triggerScenarios":"Calling parse_java_signature/parse_java_sig_meta on Java code where a `main` method parameter is an array type with an unparseable or missing element type — e.g. source truncated mid-declaration like `static void main(int[])` or `main(String[] )` inside code containing syntax errors so the grammar produces a degenerate array_type node.","commonSituations":"Users pasting incomplete Java scripts into the Windmill editor (the signature parser runs on save to build the UI argument form); programmatic code generation emitting a truncated array parameter; code with syntax errors earlier in the file that make tree-sitter's error recovery produce an array_type without an inner type node.","solutions":["Fix the Java source: ensure every array parameter has a complete element type, e.g. `public static void main(String[] args)`, with balanced brackets and no truncation.","Fix syntax errors elsewhere in the file first — a preceding ERROR node can leave the array_type node malformed; validate the file with `javac -proc:only` or an IDE before deploying.","If your code legitimately triggers this on well-formed Java, upgrade tree-sitter-java (older grammar versions had different node shapes) and re-test.","Consider treating it as a user-input error upstream: catch it and surface 'cannot parse parameter type' instead of an internal error message."],"exampleFix":"// before (truncated/broken Java given to the parser)\nclass Main { public static void main(int[]) {} }\n\n// after (complete element type)\nclass Main { public static void main(int[] a) {} }","handlingStrategy":"validation","validationCode":"// Cheap pre-check in Java source before submitting to the parser:\n// every array parameter must have an element type\nfn looks_like_broken_array_param(code: &str) -> bool {\n    code.contains(\"[])\") || code.contains(\"[] \") && code.contains(\"main(\")\n        // e.g. \"main(int[])\" — bracket pair with no identifier following\n}","typeGuard":null,"tryCatchPattern":"match parse_java_signature(code) {\n    Ok(sig) => sig,\n    Err(e) if e.to_string().contains(\"inner type of array type\") => {\n        // surface as user-input error: \"a main() parameter has an incomplete array type\"\n        bail!(\"Fix the array parameter type in your main() signature\")\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always write array parameters as `Type[] name` with the variable name present.","Make sure the whole file is syntactically valid — fix ERRORs upstream before the signature runs.","Lint the script editor input for truncated signatures on save.","Keep tree-sitter-java current so array_type nodes keep their expected child shape."],"tags":["rust","java","parser","ast"],"backgroundTag":"unparseable-function-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"}