{"record":{"id":"5e91e8d309f2369d","repo":"apache/seatunnel","slug":"branch-not-exists-5e91e8","errorCode":"BRANCH_NOT_EXISTS","errorMessage":"${branchName}","messagePattern":"\\$\\{branchName\\}","errorType":"error_code","errorClass":"PaimonConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/sink/PaimonSinkWriter.java","lineNumber":284,"sourceCode":"        this.sourceTableSchema =\n                new AlterPaimonTableSchemaEventHandler(\n                                sourceTableSchema,\n                                paimonCatalog,\n                                sinkPaimonTableSchema,\n                                paimonTablePath,\n                                paimonSinkConfig.getBranch())\n                        .apply(event);\n        reOpenTableWrite();\n    }\n\n    private void reOpenTableWrite() {\n        this.seaTunnelRowType = this.sourceTableSchema.toPhysicalRowDataType();\n        this.paimonTable = (FileStoreTable) paimonCatalog.getPaimonTable(paimonTablePath);\n        String branchName = paimonSinkConfig.getBranch();\n        if (StringUtils.isNotEmpty(branchName)) {\n            BranchManager branchManager = paimonTable.branchManager();\n            if (!branchManager.branchExists(branchName)) {\n                throw new PaimonConnectorException(\n                        PaimonConnectorErrorCode.BRANCH_NOT_EXISTS, branchName);\n            }\n            if (!branchManager.DEFAULT_MAIN_BRANCH.equalsIgnoreCase(branchName)) {\n                this.paimonTable = this.paimonTable.switchToBranch(branchName);\n                log.info(\"Re-switched to branch {} after reopening table\", branchName);\n            }\n        }\n        this.sinkPaimonTableSchema = this.paimonTable.schema();\n        this.newTableWrite();\n    }\n\n    private void newTableWrite() {\n        TableWrite oldTableWrite = this.tableWrite;\n        tableWriteClose(oldTableWrite);\n        this.tableWrite = this.paimonTable.newWrite(commitUser).withIOManager(ioManager);\n    }\n\n    @Override","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/sink/PaimonSinkWriter.java#L266-L302","documentation":"PaimonSinkWriter.reOpenTableWrite re-resolves the Paimon table (e.g. after schema change) and re-validates the configured branch. If the branch configured in paimonSinkConfig no longer exists at reopen time, BRANCH_NOT_EXISTS is thrown with the bare branch name as the message.","triggerScenarios":"applySchemaChange triggers reOpenTableWrite and `branchManager.branchExists(branchName)` returns false — the branch was dropped (e.g. by another job or cleanup) between job start and the reopen.","commonSituations":"Concurrent branch deletion by a maintenance/cleanup job; branch removed after a failed run; wrong warehouse path resolved after schema change reopen.","solutions":["Recreate the missing branch before restarting/resuming the job","Remove the `branch` option or point it to an existing branch","Prevent external jobs from deleting branches that active writers use"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"BranchManager bm = paimonTable.branchManager(); if (!bm.branchExists(paimonSinkConfig.getBranch())) { bm.createBranch(paimonSinkConfig.getBranch()); }","typeGuard":null,"tryCatchPattern":"try { writer.reOpenTableWrite(); } catch (PaimonConnectorException e) { if (PaimonConnectorErrorCode.BRANCH_NOT_EXISTS.equals(e.getErrorCode())) { /* recreate branch from config, then retry reopen */ } else { throw e; } }","preventionTips":["Disable external branch-deletion jobs while writers are active","Re-verify branch existence after schema-change restarts","Alert on branch lifecycle operations in shared warehouses"],"tags":["paimon","branch","sink"],"backgroundTag":"resource-not-found","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"}