{"record":{"id":"17667ff81966e8a6","repo":"apache/seatunnel","slug":"branch-not-exists-17667f","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/PaimonSink.java","lineNumber":117,"sourceCode":"        this.paimonBucketAssignerFactory = new PaimonBucketAssignerFactory();\n        try (PaimonCatalog paimonCatalog = PaimonCatalog.loadPaimonCatalog(readonlyConfig)) {\n            paimonCatalog.open();\n            boolean databaseExists =\n                    paimonCatalog.databaseExists(this.paimonSinkConfig.getNamespace());\n            if (!databaseExists) {\n                return;\n            }\n            TablePath tablePath = catalogTable.getTablePath();\n            boolean tableExists = paimonCatalog.tableExists(tablePath);\n            if (!tableExists) {\n                return;\n            }\n            this.paimonTable = (FileStoreTable) paimonCatalog.getPaimonTable(tablePath);\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 = paimonTable.switchToBranch(branchName);\n                    log.info(\"Switch to branch {}\", branchName);\n                }\n            }\n        }\n    }\n\n    @Override\n    public String getPluginName() {\n        return PLUGIN_NAME;\n    }\n\n    @Override\n    public PaimonSinkWriter createWriter(SinkWriter.Context context) throws IOException {\n        return new PaimonSinkWriter(","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/sink/PaimonSink.java#L99-L135","documentation":"In the PaimonSink constructor, if the sink config specifies a non-empty `branch`, the connector checks `branchManager.branchExists(branchName)` on the target table and throws BRANCH_NOT_EXISTS with the bare branch name as the message when it is absent.","triggerScenarios":"Instantiating PaimonSink with paimonSinkConfig.getBranch() set to a branch name that does not exist on the resolved tablePath in the Paimon catalog.","commonSituations":"Branch name typo; branch created after job submission but sink reads table from a different warehouse/catalog; branch deleted by retention cleanup; confusion between tag and branch names.","solutions":["Create the branch on the table before submitting the job (Paimon `create_branch` procedure)","Correct the `branch` option value in the sink config","Confirm the catalog/warehouse config resolves to the same table where the branch exists"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"if (StringUtils.isNotEmpty(branchName)) { BranchManager bm = ((FileStoreTable) catalog.getPaimonTable(tablePath)).branchManager(); if (!bm.branchExists(branchName)) { bm.createBranch(branchName); } }","typeGuard":null,"tryCatchPattern":"try { sink = new PaimonSink(...); } catch (PaimonConnectorException e) { if (PaimonConnectorErrorCode.BRANCH_NOT_EXISTS.equals(e.getErrorCode())) { /* branch = e.getMessage(); create it or correct config */ } else { throw e; } }","preventionTips":["Create branches as a pipeline pre-step","Keep branch names in shared config validated against the catalog","Protect branches used by writers from cleanup jobs"],"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"}