{"record":{"id":"6a8b251f15a66fbd","repo":"apache/seatunnel","slug":"formaterrormessage-action-xid-errorcode-errorme","errorCode":null,"errorMessage":"formatErrorMessage(action, xid, errorCode, errorMessage)","messagePattern":"formatErrorMessage\\(action, xid, errorCode, errorMessage\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaFacadeImplAutoLoad.java","lineNumber":212,"sourceCode":"                    formatErrorMessage(\"prepare\", of(xid), empty(), \"response: \" + prepResult));\n        }\n    }\n\n    @Override\n    public void failAndRollback(Xid xid) {\n        execute(\n                Command.fromRunnable(\n                        \"end (fail)\",\n                        xid,\n                        () -> {\n                            xaResource.end(xid, XAResource.TMFAIL);\n                            xaResource.rollback(xid);\n                        },\n                        err -> {\n                            if (err.errorCode >= XA_RBBASE) {\n                                rollback(xid);\n                            } else {\n                                LOG.warn(\n                                        formatErrorMessage(\n                                                \"end (fail)\", of(xid), of(err.errorCode)));\n                            }\n                        }));\n    }\n\n    @Override\n    public void commit(Xid xid, boolean ignoreUnknown) {\n        execute(\n                Command.fromRunnableRecoverByWarn(\n                        \"commit\",\n                        xid,\n                        () ->\n                                xaResource.commit(\n                                        xid,\n                                        false /* not onePhase because the transaction should be prepared already */),\n                        e -> buildCommitErrorDesc(e, ignoreUnknown)));\n    }","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaFacadeImplAutoLoad.java#L194-L230","documentation":"A WARN log produced by formatErrorMessage(...) in XaFacadeImplAutoLoad.failAndRollback(). When ending a transaction in fail mode (end+rollback for a prepared-but-uncommitted XA transaction) fails with an XAException whose code is below XA_RBBASE (i.e. not a rollback-related code), the facade logs a formatted message with the action, xid and error code instead of retrying rollback. The transaction's fate depends on the recovery mechanism.","triggerScenarios":"failAndRollback(xid) executes end(fail)+rollback asynchronously; the XAException error code is unexpected (< XA_RBBASE), so rollback is skipped and only a formatted warning (action, xid, errorCode) is emitted.","commonSituations":"Transaction already committed/rolled back elsewhere (recovery race); XA protocol violation from the driver; resource manager temporarily unavailable during abort path.","solutions":["Inspect the errorCode in the log to map to the driver/vendor XA error documentation","Check for duplicate recovery processes rolling back the same xid concurrently","Verify the DB's XA support and driver compatibility; retry the job or run XA recovery (xa_recover) manually if in-doubt transactions accumulate"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Ensure no concurrent recovery processes operate on the same xid namespace\n// and the DB user has XA privileges:\n// GRANT XA_RECOVER_ADMIN ON *.* TO 'user'@'host'; -- MySQL","typeGuard":null,"tryCatchPattern":"// XAException handling in user code if replicating abort logic:\ntry {\n    xaResource.end(xid, XAResource.TMFAIL);\n    xaResource.rollback(xid);\n} catch (XAException e) {\n    if (e.errorCode >= XAException.XA_RBBASE) {\n        xaResource.rollback(xid);\n    } else {\n        LOG.warn(\"end(fail) failed, errorCode=\" + e.errorCode + \", xid=\" + xid);\n    }\n}","preventionTips":["Avoid running two recovery processes with the same transaction prefix","Map the logged errorCode to vendor XA documentation","Ensure stable network to the DB during checkpoint abort paths"],"tags":["jdbc","xa","rollback","transaction"],"backgroundTag":"sql-query-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"}