{"record":{"id":"afd74b559118f836","repo":"apache/seatunnel","slug":"plugin-type-must-be-one-of-source-sink-transfo","errorCode":null,"errorMessage":"Plugin type must be one of: [source, sink, transform]","messagePattern":"Plugin type must be one of: \\[source, sink, transform\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/args/MetadataExportCommandArgs.java","lineNumber":76,"sourceCode":"    private boolean prettyPrint = true;\n\n    @Parameter(\n            names = {\"--stdout\"},\n            description = \"Write JSON to stdout instead of a file\")\n    private boolean stdout = false;\n\n    @Override\n    public Command<?> buildCommand() {\n        return new MetadataExportCommand(this);\n    }\n\n    public static class PluginTypeConverter implements IStringConverter<PluginType> {\n        @Override\n        public PluginType convert(String value) {\n            try {\n                return PluginType.valueOf(value.toUpperCase());\n            } catch (IllegalArgumentException e) {\n                throw new IllegalArgumentException(\n                        \"Plugin type must be one of: [source, sink, transform]\");\n            }\n        }\n    }\n}\n","sourceCodeStart":58,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/args/MetadataExportCommandArgs.java#L58-L82","documentation":"MetadataExportCommandArgs.PluginTypeConverter converts the --plugin-type CLI argument to the PluginType enum via PluginType.valueOf on the uppercased value. If the user supplies any string that is not exactly source, sink, or transform (case-insensitive), the IllegalArgumentException from valueOf is rethrown with a message listing the allowed values. It exists to give a clear CLI-level message instead of a raw enum stack trace.","triggerScenarios":"Running the metadata export command (e.g. seatunnel.sh -m) with --plugin-type set to a value other than source/sink/transform, such as 'Source ', 'sources', 'reader', or a typo like 'sourc'. JCommander invokes the converter during argument parsing, before the command executes.","commonSituations":"Typo in the CLI flag value; assuming case or plural forms matter; copying plugin-type values from connector configs where other names exist; scripting with a variable that contains an unexpected value.","solutions":["Set --plugin-type to exactly one of source, sink, or transform (case-insensitive).","Check for hidden whitespace or plural forms in scripts passing the value.","Run with --help on the metadata export command to see the documented flag values."],"exampleFix":"// before\nseatunnel.sh -m --plugin-type reader\n// after\nseatunnel.sh -m --plugin-type source","handlingStrategy":"validation","validationCode":"const VALID = [\"source\", \"sink\", \"transform\"];\nif (!VALID.includes(pluginType.trim().toLowerCase())) {\n  throw new Error(\"plugin-type must be one of: \" + VALID.join(\", \"));\n}","typeGuard":"function isPluginType(v) { return [\"source\",\"sink\",\"transform\"].includes(v.trim().toLowerCase()); }","tryCatchPattern":"try { runExport(args); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Plugin type must be\")) { System.err.println(\"Fix --plugin-type: \" + e.getMessage()); } else { throw e; } }","preventionTips":["Keep allowed plugin-type values in a shared constant used by scripts","Trim and lowercase values before passing them to the CLI","Use shell tab-completion or a wrapper script that validates flags"],"tags":["cli","enum","argument-parsing"],"backgroundTag":"invalid-enum-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}