{"record":{"id":"6527dba2f2151069","repo":"apache/incubator-seata","slug":"unknown-lock-mode","errorCode":null,"errorMessage":"unknown lock mode:{}","messagePattern":"unknown lock mode:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/org/apache/seata/common/store/LockMode.java","lineNumber":49,"sourceCode":"    REDIS(\"redis\"),\n    /**\n     * raft store\n     */\n    RAFT(\"raft\");\n\n    private String name;\n\n    LockMode(String name) {\n        this.name = name;\n    }\n\n    public static LockMode get(String name) {\n        for (LockMode mode : LockMode.values()) {\n            if (mode.getName().equalsIgnoreCase(name)) {\n                return mode;\n            }\n        }\n        throw new IllegalArgumentException(\"unknown lock mode:\" + name);\n    }\n\n    /**\n     * whether contains value of store mode\n     *\n     * @param name the mode name\n     * @return the boolean\n     */\n    public static boolean contains(String name) {\n        try {\n            return get(name) != null ? true : false;\n        } catch (IllegalArgumentException e) {\n            return false;\n        }\n    }\n\n    public String getName() {\n        return name;","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/common/src/main/java/org/apache/seata/common/store/LockMode.java#L31-L67","documentation":"LockMode.get(name) maps a configuration string to the LockMode enum (file, db, redis, raft) using case-insensitive comparison. Any other value throws IllegalArgumentException 'unknown lock mode:<name>'. LockMode.contains() exists specifically to test membership without throwing.","triggerScenarios":"Setting server or client lock mode config (e.g. lockMode/seata.lock-mode, or LockMode.get(System.getProperty(...))) to a value outside {file, db, redis, raft} — including null, empty string, or a typo.","commonSituations":"Typos like 'db2' or 'redis-cluster'; using a removed/renamed mode after upgrading seata; passing store.mode value where lock mode is expected (e.g. 'file' is valid but 'mysql' is not a lock mode).","solutions":["Set the lock mode to one of file, db, redis, raft (case-insensitive).","Check the exact property you are editing — store.mode accepts more values (e.g. mysql) than lock mode does.","If validating user/config input programmatically, call LockMode.contains(name) first."],"exampleFix":"# before\nseata.lock-mode=mysql\n\n# after\nseata.lock-mode=db","handlingStrategy":"validation","validationCode":"String mode = config.get(\"seata.lock-mode\");\nif (!LockMode.contains(mode)) {\n    throw new IllegalArgumentException(\"lock-mode must be one of file/db/redis/raft, got: \" + mode);\n}\nLockMode lockMode = LockMode.get(mode);","typeGuard":null,"tryCatchPattern":"try {\n    LockMode mode = LockMode.get(name);\n} catch (IllegalArgumentException e) {\n    // message echoes the bad value; log valid options and fail config validation\n    throw e;\n}","preventionTips":["Restrict lock-mode values in config templates to the supported set.","Validate all seata enum-backed properties at startup using their contains() helpers.","Remember db, not mysql/database, is the database lock mode value."],"tags":["configuration","enum","lock","seata"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}