{"record":{"id":"dd559c06ce5eaa47","repo":"apache/incubator-seata","slug":"cannot-convert-name-dd559c","errorCode":null,"errorMessage":"Cannot convert {name}","messagePattern":"Cannot convert (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compatible/src/main/java/io/seata/saga/statelang/domain/StateMachine.java","lineNumber":246,"sourceCode":"        }\n\n        /**\n         * Wrap status.\n         *\n         * @param target the target\n         * @return the status\n         */\n        public static Status wrap(org.apache.seata.saga.statelang.domain.StateMachine.Status target) {\n            if (target == null) {\n                return null;\n            }\n            switch (target) {\n                case AC:\n                    return AC;\n                case IN:\n                    return IN;\n                default:\n                    throw new IllegalArgumentException(\"Cannot convert \" + target.name());\n            }\n        }\n\n        /**\n         * Unwrap org . apache . seata . saga . statelang . domain . state machine . status.\n         *\n         * @return the org . apache . seata . saga . statelang . domain . state machine . status\n         */\n        public org.apache.seata.saga.statelang.domain.StateMachine.Status unwrap() {\n            switch (this) {\n                case AC:\n                    return org.apache.seata.saga.statelang.domain.StateMachine.Status.AC;\n                case IN:\n                    return org.apache.seata.saga.statelang.domain.StateMachine.Status.IN;\n                default:\n                    throw new IllegalArgumentException(\"Cannot convert \" + this.name());\n            }\n        }","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/compatible/src/main/java/io/seata/saga/statelang/domain/StateMachine.java#L228-L264","documentation":"Thrown by StateMachine.Status.wrap(...) when converting an Apache Seata StateMachine.Status (AC/IN) to the io.seata compatibility enum and the default branch is hit. Both constants are mapped, so the exception can only occur when the two StateMachine$Status enum classes on the classpath were compiled from different Seata versions with mismatched constant sets.","triggerScenarios":"Calling StateMachine.Status.wrap(target) — typically invoked implicitly when the compatible layer adapts a state machine loaded by the org.apache.seata saga engine — where the runtime org.apache.seata StateMachine.Status enum carries a constant unknown to the compatible jar.","commonSituations":"Rolling upgrades of a Seata-based saga service where some pods run io.seata 1.x adapters against an org.apache.seata 2.x server; libraries that embed their own copy of seata-saga-statelang; snapshot/local builds compiled against a fork that added a status constant.","solutions":["Make the compatible artifact (io.seata) and the core artifact (org.apache.seata) the exact same release across all modules.","Verify with 'mvn dependency:tree' / 'gradle dependencies' that only one seata-saga-statelang version resolves.","If you maintain a fork that adds enum constants, regenerate the compatible layer so wrap()/unwrap() cover them."],"exampleFix":"// before (skewed versions)\n // app module: org.apache.seata 2.2.0, common module: io.seata compatible 2.0.0\n StateMachine.Status s = StateMachine.Status.wrap(apacheStatus); // IllegalArgumentException\n\n// after\n dependencyManagement {\n     imports { mavenBom(\"org.apache.seata:seata-parent:2.2.0\") }\n }","handlingStrategy":"validation","validationCode":"private static final Set<String> MAPPABLE = Set.of(\"AC\", \"IN\");\n\npublic static StateMachine.Status safeWrap(org.apache.seata.saga.statelang.domain.StateMachine.Status target) {\n    if (target != null && !MAPPABLE.contains(target.name())) {\n        throw new IllegalStateException(\"StateMachine.Status '\" + target\n            + \"' unmappable; align io.seata and org.apache.seata versions\");\n    }\n    return StateMachine.Status.wrap(target);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return StateMachine.Status.wrap(target);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"StateMachine.Status unmappable: \" + target, e);\n}","preventionTips":["Use one Seata BOM across all modules of a multi-service platform.","In rolling-upgrade deployments, finish the whole rollout before processing saga traffic that crosses old/new pods.","Add CI checks that compare enum constant sets between the compatible jar and core jar."],"tags":["saga","enum","compatibility","version-mismatch","state-machine"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}