{"record":{"id":"bfb535e24aca3e56","repo":"apache/seatunnel","slug":"unsupported-action-type-bfb535","errorCode":null,"errorMessage":"Unsupported action type: ","messagePattern":"Unsupported action type: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java","lineNumber":750,"sourceCode":"        }\n    }\n\n    @Override\n    public PreviewResult previewAction(\n            ActionType actionType, TablePath tablePath, Optional<CatalogTable> catalogTable) {\n        if (actionType == ActionType.CREATE_TABLE) {\n            checkArgument(catalogTable.isPresent(), \"CatalogTable cannot be null\");\n            return new SQLPreviewResult(getCreateTableSql(tablePath, catalogTable.get(), true));\n        } else if (actionType == ActionType.DROP_TABLE) {\n            return new SQLPreviewResult(getDropTableSql(tablePath));\n        } else if (actionType == ActionType.TRUNCATE_TABLE) {\n            return new SQLPreviewResult(getTruncateTableSql(tablePath));\n        } else if (actionType == ActionType.CREATE_DATABASE) {\n            return new SQLPreviewResult(getCreateDatabaseSql(tablePath.getDatabaseName()));\n        } else if (actionType == ActionType.DROP_DATABASE) {\n            return new SQLPreviewResult(getDropDatabaseSql(tablePath.getDatabaseName()));\n        } else {\n            throw new UnsupportedOperationException(\"Unsupported action type: \" + actionType);\n        }\n    }\n}\n","sourceCodeStart":732,"sourceCodeEnd":754,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/AbstractJdbcCatalog.java#L732-L754","documentation":"previewAction only supports a fixed set of ActionTypes (CREATE_TABLE, DROP_TABLE, TRUNCATE_TABLE, CREATE_DATABASE, DROP_DATABASE). Any other ActionType reaches the else branch and throws UnsupportedOperationException with 'Unsupported action type: <type>'.","triggerScenarios":"Calling catalog.previewAction(actionType, tablePath, catalogTable) with an ActionType outside the supported set, e.g. newer enum values added to the API that the JDBC catalog has not implemented.","commonSituations":"Calling preview on newly introduced action types after a SeaTunnel version upgrade; generic tooling that iterates all ActionType values against every catalog.","solutions":["Restrict previewAction calls to the supported ActionTypes (CREATE_TABLE, DROP_TABLE, TRUNCATE_TABLE, CREATE_DATABASE, DROP_DATABASE)","Upgrade SeaTunnel / the JDBC connector to a version that implements the new action type","Handle UnsupportedOperationException defensively when previewing arbitrary action types"],"exampleFix":"// before\ncatalog.previewAction(unknownActionType, tablePath, Optional.empty());\n// after\nif (actionType == ActionType.CREATE_TABLE || actionType == ActionType.DROP_TABLE\n        || actionType == ActionType.TRUNCATE_TABLE\n        || actionType == ActionType.CREATE_DATABASE || actionType == ActionType.DROP_DATABASE) {\n    catalog.previewAction(actionType, tablePath, Optional.empty());\n}","handlingStrategy":"validation","validationCode":"// Java\nprivate static final Set<ActionType> SUPPORTED = Set.of(\n    ActionType.CREATE_TABLE, ActionType.DROP_TABLE, ActionType.TRUNCATE_TABLE,\n    ActionType.CREATE_DATABASE, ActionType.DROP_DATABASE);\nboolean previewable = SUPPORTED.contains(actionType);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whitelist ActionTypes before calling previewAction rather than passing arbitrary values","After upgrading SeaTunnel, re-check which ActionTypes the JDBC catalog supports","Never iterate all ActionType values generically against this catalog"],"tags":["jdbc","unsupported-operation","preview"],"backgroundTag":"unsupported-enum-value","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"}