{"record":{"id":"72e2b60284d1bbbb","repo":"apache/seatunnel","slug":"invalid-status-status-expected-pending-send","errorCode":null,"errorMessage":"Invalid --status ${status}; expected PENDING, SENDING, ACKED, or DEAD","messagePattern":"Invalid --status (.+?); expected PENDING, SENDING, ACKED, or DEAD","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/EdgeAgentDbCommand.java","lineNumber":407,"sourceCode":"        }\n    }\n\n    private long countByStatus(EdgeAgentDbConnection db, String sql, String status)\n            throws SQLException {\n        try (PreparedStatement statement = db.getConnection().prepareStatement(sql)) {\n            statement.setString(1, status);\n            try (ResultSet rs = statement.executeQuery()) {\n                rs.next();\n                return rs.getLong(1);\n            }\n        }\n    }\n\n    private void validateWalStatus(String status) {\n        try {\n            WalRecordStatus.valueOf(status);\n        } catch (IllegalArgumentException ex) {\n            throw new IllegalArgumentException(\n                    \"Invalid --status \" + status + \"; expected PENDING, SENDING, ACKED, or DEAD\",\n                    ex);\n        }\n    }\n\n    private static String formatTime(long epochMs) {\n        return TIME_FMT.format(Instant.ofEpochMilli(epochMs));\n    }\n\n    private static long ageMs(long epochMs) {\n        return Math.max(0L, System.currentTimeMillis() - epochMs);\n    }\n\n    private static String nullToDash(String value) {\n        return value == null ? \"-\" : value;\n    }\n\n    private static String previewUtf8(byte[] bytes) {","sourceCodeStart":389,"sourceCodeEnd":425,"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/EdgeAgentDbCommand.java#L389-L425","documentation":"runWalList accepts an optional --status filter that must be one of the WalRecordStatus enum values. validateWalStatus attempts WalRecordStatus.valueOf and converts failure into an IllegalArgumentException listing the four accepted values, chaining the original exception for diagnostics.","triggerScenarios":"Running wal-list --status with a value other than PENDING, SENDING, ACKED, or DEAD (e.g. lowercase 'acked', 'failed', 'done', or values with trailing whitespace).","commonSituations":"Users pass lowercase status names; scripts pass statuses from other systems ('dead-letter', 'sent'); typos such as 'PENDNG'.","solutions":["Use an exact uppercase match: --status PENDING, SENDING, ACKED, or DEAD.","Trim whitespace and normalize case in the calling script before passing the value.","Validate against the allowed list in wrapper scripts before invoking the CLI.","Consult the WalRecordStatus enum for the authoritative set of statuses."],"exampleFix":"// before\nagent db wal-list --status acked\n// after\nagent db wal-list --status ACKED","handlingStrategy":"validation","validationCode":"VALID = {'PENDING','SENDING','ACKED','DEAD'}\nif status is not None:\n    status = status.strip().upper()\n    if status not in VALID:\n        raise ValueError(f'Invalid --status {status}; expected PENDING, SENDING, ACKED, or DEAD')","typeGuard":null,"tryCatchPattern":"try {\n  runWalList(status, limit);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Invalid --status\")) {\n    System.err.println(\"Use one of: PENDING, SENDING, ACKED, DEAD (uppercase)\");\n  }\n}","preventionTips":["Normalize case and trim whitespace before passing --status.","Keep status values in sync with the WalRecordStatus enum; never invent new names.","Source the status from a fixed whitelist in wrapper scripts."],"tags":["cli","validation","enum","status"],"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"}