{"record":{"id":"14bbd141aab2ad69","repo":"apache/seatunnel","slug":"unknown-db-subcommand-getsubcommand","errorCode":null,"errorMessage":"Unknown db subcommand: ${getSubcommand()}","messagePattern":"Unknown db subcommand: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-edge-agent/seatunnel-edge-agent-starter/src/main/java/org/apache/seatunnel/edge/agent/starter/command/db/DbCommandArgs.java","lineNumber":84,"sourceCode":"\n    @Parameter(\n            names = {\"--source-id\"},\n            description = \"Filter source positions\")\n    private String sourceId;\n\n    @Parameter(\n            names = {\"--older-than-ms\"},\n            description = \"Cutoff age in ms for wal-purge-acked\")\n    private long olderThanMs = 0L;\n\n    @Override\n    public EdgeAgentCommand<?> buildCommand() {\n        if (getSubcommand() == null || \"help\".equals(getSubcommand())) {\n            return new EdgeAgentDbHelpCommand();\n        }\n        DbSubcommand subcommand = DbSubcommand.fromCliName(getSubcommand());\n        if (subcommand == null) {\n            throw new IllegalArgumentException(\"Unknown db subcommand: \" + getSubcommand());\n        }\n        if (subcommand == DbSubcommand.WAL_SHOW && walId == null) {\n            throw new IllegalArgumentException(\n                    \"wal-show requires --id <row-id> (run db wal-list; use the id column)\");\n        }\n        return new EdgeAgentDbCommand(this, subcommand);\n    }\n\n    public String getSubcommand() {\n        if (commands == null || commands.isEmpty()) {\n            return null;\n        }\n        return commands.get(0);\n    }\n\n    public Path getSqlitePathOverride() {\n        if (sqlitePath == null || sqlitePath.trim().isEmpty()) {\n            return null;","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-edge-agent/seatunnel-edge-agent-starter/src/main/java/org/apache/seatunnel/edge/agent/starter/command/db/DbCommandArgs.java#L66-L102","documentation":"DbCommandArgs.buildCommand() resolves the db subcommand name against the DbSubcommand enum; when the name is not null/help and does not match any known CLI name it throws IllegalArgumentException. This guards the CLI parser against unrecognized db subcommands.","triggerScenarios":"Invoking the agent CLI with `db <unknown>` where <unknown> is not a registered subcommand (e.g. a typo like `walshow` instead of `wal-show`).","commonSituations":"Typos in subcommand names; scripts written against an older CLI before a subcommand was renamed or added; guessing subcommand names without running `db help`.","solutions":["Run `db help` (or omit the subcommand) to list valid subcommands","Fix the typo in the CLI invocation (names are kebab-case, e.g. wal-show, wal-list)","Check the installed agent version — the subcommand may not exist in that release"],"exampleFix":"// before\ndb walshow --id 42\n// after\ndb wal-show --id 42","handlingStrategy":"validation","validationCode":"// before running, confirm the subcommand\nSet<String> valid = Set.of(\"help\", \"wal-list\", \"wal-show\");\nif (!valid.contains(subcommand)) { throw new IllegalArgumentException(\"Unknown: \" + subcommand); }","typeGuard":null,"tryCatchPattern":"try {\n    dbCommandArgs.buildCommand();\n} catch (IllegalArgumentException e) {\n    printDbHelp();\n}","preventionTips":["Run `db help` to discover valid subcommands","Use shell completion or constants instead of hand-typed names","Pin scripts to a known agent version when subcommands change"],"tags":["cli","command-line","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}