{"record":{"id":"b28ecb8d7a239690","repo":"apache/seatunnel","slug":"invalid-argument-should-have-2-parts","errorCode":null,"errorMessage":"Invalid argument , should have 2 parts","messagePattern":"Invalid argument , should have 2 parts","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/utils/SchemaUtils.java","lineNumber":377,"sourceCode":"                                    Pair<String, Integer> args = transformArgPair(matcher.group(2));\n                                    specBuilder.truncate(args.first(), args.second());\n                                    break;\n                                }\n                            default:\n                                throw new UnsupportedOperationException(\n                                        \"Unsupported transform: \" + transform);\n                        }\n                    } else {\n                        specBuilder.identity(partitionField);\n                    }\n                });\n        return specBuilder.build();\n    }\n\n    private static Pair<String, Integer> transformArgPair(String argsStr) {\n        String[] parts = argsStr.split(\",\");\n        if (parts.length != 2) {\n            throw new IllegalArgumentException(\n                    \"Invalid argument \" + argsStr + \", should have 2 parts\");\n        }\n        return Pair.of(parts[0].trim(), Integer.parseInt(parts[1].trim()));\n    }\n}\n","sourceCodeStart":359,"sourceCodeEnd":383,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/utils/SchemaUtils.java#L359-L383","documentation":"SchemaUtils.transformArgPair parses the comma-separated argument list inside a parameterized partition transform like bucket[16,id] or truncate[10,name]. It requires exactly two parts: column name and width. If the split doesn't yield exactly two parts, it throws IllegalArgumentException 'Invalid argument <argsStr>, should have 2 parts'.","triggerScenarios":"A transform argument string with the wrong number of comma-separated parts, e.g. 'bucket[16]' argument portion '16' (one part) or 'bucket[16,col,extra]' (three parts) passed into SchemaUtils while building the partition spec.","commonSituations":"Users writing Iceberg-style 'bucket[16](col)' syntax where the connector expects 'bucket[16,col]'; missing column name; stray commas from copy-paste; omitting the column in the bracketed argument.","solutions":["Format parameterized transforms as transform[width,column], e.g. bucket[16,id] or truncate[10,name]","Count the comma-separated parts in the bracketed argument string — must be exactly 2","Check for stray/missing commas in the partition config","If using identity or simple temporal transforms, drop the bracketed argument entirely instead"],"exampleFix":"// before\npartition = { transform = \"bucket[16]\" }\n// after\npartition = { transform = \"bucket[16,id]\" }","handlingStrategy":"validation","validationCode":"String inner = transformStr.substring(transformStr.indexOf('[') + 1, transformStr.indexOf(']'));\nString[] parts = inner.split(\",\");\nif (parts.length != 2) {\n    throw new IllegalArgumentException(\"Transform args must be [width,column]: \" + inner);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Pair<String,Integer> arg = SchemaUtils.transformArgPair(argsStr);\n} catch (IllegalArgumentException e) {\n    log.error(\"Bad partition transform args '{}': use e.g. bucket[16,id]\", argsStr);\n    throw e;\n}","preventionTips":["Always include both width and column inside the brackets: bucket[16,col]","Do not use engine-specific syntax like bucket[16](col)","Count commas before saving partition config","Cover transform parsing with unit tests using representative config strings"],"tags":["iceberg","partitioning","argument-parsing","config"],"backgroundTag":"invalid-argument-format","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}