{"record":{"id":"5d54394c22f9874f","repo":"apache/seatunnel","slug":"api-09-5d5439","errorCode":"API-09","errorMessage":"Handle save mode failed","messagePattern":"Handle save mode failed","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/execution/AbstractSinkExecuteProcessor.java","lineNumber":262,"sourceCode":"        }\n        if (sinks.values().stream().anyMatch(sink -> !(sink instanceof SupportMultiTableSink))) {\n            LOGGER.info(\"Unsupported multi table sink api, rollback to sink template\");\n            // choose the first sink\n            return sinks.values().iterator().next();\n        }\n        return FactoryUtil.createMultiTableSink(sinks, sinkConfig, classLoader);\n    }\n\n    public void handleSaveMode(SeaTunnelSink seaTunnelSink) {\n        if (seaTunnelSink instanceof SupportSaveMode) {\n            SupportSaveMode saveModeSink = (SupportSaveMode) seaTunnelSink;\n            Optional<SaveModeHandler> saveModeHandler = saveModeSink.getSaveModeHandler();\n            if (saveModeHandler.isPresent()) {\n                try (SaveModeHandler handler = saveModeHandler.get()) {\n                    handler.open();\n                    new SaveModeExecuteWrapper(handler).execute();\n                } catch (Exception e) {\n                    throw new SeaTunnelRuntimeException(HANDLE_SAVE_MODE_FAILED, e);\n                }\n            }\n        }\n    }\n\n    protected boolean shouldContinueOtherTables() {\n        return MultiTableFailureHelper.shouldContinueOtherTables(\n                ReadonlyConfig.fromConfig(envConfig));\n    }\n\n    protected RuntimeException wrapThrowable(Throwable error) {\n        if (error instanceof RuntimeException) {\n            return (RuntimeException) error;\n        }\n        return new RuntimeException(error);\n    }\n\n    private void logSkippedTable(","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-core/seatunnel-flink-starter/seatunnel-flink-starter-common/src/main/java/org/apache/seatunnel/core/starter/flink/execution/AbstractSinkExecuteProcessor.java#L244-L280","documentation":"SeaTunnelRuntimeException with code API-09 thrown by AbstractSinkExecuteProcessor.handleSaveMode when a sink's SaveModeHandler fails during open() or execution of its save-mode actions (table creation / schema evolution). The sink pipeline is aborted because pre-write DDL could not be applied.","triggerScenarios":"Sink implements SupportsSaveMode and returns a SaveModeHandler; opening the catalog connection or executing the save-mode commands throws (privileges missing, invalid DDL, database unreachable) while handleSaveMode runs during execute().","commonSituations":"No CREATE privilege on the target database; custom save_mode SQL invalid for the dialect; transient catalog connectivity failures.","solutions":["Check the cause exception for the underlying database error","Grant needed DDL privileges or pre-create tables and drop save_mode auto-creation","Correct save_mode configuration (wrong SQL, wrong dialect) in the sink config"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// test save-mode DDL against target DB before job run\ntry (Statement s = conn.createStatement()) {\n    s.execute(\"SELECT 1\"); // connection check\n}","typeGuard":null,"tryCatchPattern":"try {\n    processor.execute();\n} catch (SeaTunnelRuntimeException e) {\n    if (\"API-09\".equals(e.getSeaTunnelErrorCode().getCode())) {\n        log.error(\"Save mode handler failed: {}\", e.getCause().getMessage());\n    }\n    throw e;\n}","preventionTips":["Grant DDL privileges to the sink user","Validate custom save_mode SQL for the target dialect","Monitor catalog connectivity before job submission"],"tags":["save-mode","sink","ddl"],"backgroundTag":"database-write-failed","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"}