{"record":{"id":"d5d9e486061deec8","repo":"apache/incubator-seata","slug":"unknown-branchtype-name","errorCode":null,"errorMessage":"Unknown BranchType[{name}]","messagePattern":"Unknown BranchType\\[(.+?)\\]","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compatible/src/main/java/io/seata/core/model/BranchType.java","lineNumber":85,"sourceCode":"                return branchType;\n            }\n        }\n        throw new IllegalArgumentException(\"Unknown BranchType[\" + ordinal + \"]\");\n    }\n\n    /**\n     * Get branch type.\n     *\n     * @param name the name\n     * @return the branch type\n     */\n    public static BranchType get(String name) {\n        for (BranchType branchType : values()) {\n            if (branchType.name().equalsIgnoreCase(name)) {\n                return branchType;\n            }\n        }\n        throw new IllegalArgumentException(\"Unknown BranchType[\" + name + \"]\");\n    }\n\n    public org.apache.seata.core.model.BranchType convertBranchType() {\n        return org.apache.seata.core.model.BranchType.get(this.name());\n    }\n}\n","sourceCodeStart":67,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/compatible/src/main/java/io/seata/core/model/BranchType.java#L67-L92","documentation":"Compatible-layer BranchType.get(String): resolves a branch type by (case-insensitive) name and throws when no constant matches. Any typo or future/legacy name outside AT/TCC/SAGA/XA is rejected.","triggerScenarios":"Calling BranchType.get(name) with a string like 'at ' (trailing space), 'At' works but 'AT_MODE', 'tcc2', or an empty string does not; also names introduced by newer versions that this build does not know.","commonSituations":"Config files or JSON state-machine definitions with misspelled branch type names; whitespace from config interpolation; version skew where a peer sends a new branch type name.","solutions":["Correct the name to exactly one of: AT, TCC, SAGA, XA (case-insensitive, no whitespace).","Trim and validate the value before passing it in.","Upgrade the compatible module if the name is a legitimately new branch type."],"exampleFix":"# before (state machine / config)\n\"Type\": \"AT \"\n\"type\": \"at_mode\"\n\n# after\n\"Type\": \"AT\"\n\"type\": \"AT\"","handlingStrategy":"validation","validationCode":"private static final Set<String> VALID = Set.of(\"AT\", \"TCC\", \"SAGA\", \"XA\");\n\nString normalized = name == null ? \"\" : name.trim().toUpperCase();\nif (!VALID.contains(normalized)) {\n    throw new IllegalArgumentException(\"branch type must be one of \" + VALID + \": \" + name);\n}\nreturn BranchType.get(normalized);","typeGuard":"boolean isValidBranchTypeName(String name) {\n    if (name == null) return false;\n    for (io.seata.core.model.BranchType t : io.seata.core.model.BranchType.values()) {\n        if (t.name().equalsIgnoreCase(name.trim())) return true;\n    }\n    return false;\n}","tryCatchPattern":"try {\n    return BranchType.get(name);\n} catch (IllegalArgumentException e) {\n    throw new ConfigurationException(\"unknown branch type '\" + name + \"'; expected AT/TCC/SAGA/XA\", e);\n}","preventionTips":["Normalize (trim + uppercase) branch type strings from config before lookup.","Restrict accepted values with an enum dropdown/validation in config tooling.","Watch for whitespace introduced by YAML/JSON interpolation."],"tags":["enum","validation","configuration","branch-type"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}