apache/incubator-seata · error · IllegalArgumentException

unknown lock mode:{}

Error message

unknown lock mode:{}

What it means

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.

Source

Thrown at common/src/main/java/org/apache/seata/common/store/LockMode.java:49

    REDIS("redis"),
    /**
     * raft store
     */
    RAFT("raft");

    private String name;

    LockMode(String name) {
        this.name = name;
    }

    public static LockMode get(String name) {
        for (LockMode mode : LockMode.values()) {
            if (mode.getName().equalsIgnoreCase(name)) {
                return mode;
            }
        }
        throw new IllegalArgumentException("unknown lock mode:" + name);
    }

    /**
     * whether contains value of store mode
     *
     * @param name the mode name
     * @return the boolean
     */
    public static boolean contains(String name) {
        try {
            return get(name) != null ? true : false;
        } catch (IllegalArgumentException e) {
            return false;
        }
    }

    public String getName() {
        return name;

View on GitHub (pinned to e01f97c6db)

Solutions

  1. Set the lock mode to one of file, db, redis, raft (case-insensitive).
  2. Check the exact property you are editing — store.mode accepts more values (e.g. mysql) than lock mode does.
  3. If validating user/config input programmatically, call LockMode.contains(name) first.

Example fix

# before
seata.lock-mode=mysql

# after
seata.lock-mode=db
Defensive patterns

Strategy: validation

Validate before calling

String mode = config.get("seata.lock-mode");
if (!LockMode.contains(mode)) {
    throw new IllegalArgumentException("lock-mode must be one of file/db/redis/raft, got: " + mode);
}
LockMode lockMode = LockMode.get(mode);

Try / catch

try {
    LockMode mode = LockMode.get(name);
} catch (IllegalArgumentException e) {
    // message echoes the bad value; log valid options and fail config validation
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14). Data as JSON: /api/errors/6527dba2f2151069. Report an issue: GitHub.