apache/incubator-seata · error · IllegalArgumentException

unknown store mode:{}

Error message

unknown store mode:{}

What it means

StoreMode.get(name) converts a store.mode configuration string to the StoreMode enum (values such as file, db, redis, raft) case-insensitively. Any unrecognized value throws IllegalArgumentException 'unknown store mode:<name>'. StoreMode.contains(name) wraps get() in try/catch and returns false instead of throwing, for safe validation.

Source

Thrown at common/src/main/java/org/apache/seata/common/store/StoreMode.java:63

    private String name;

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

    /**
     * get value of store mode
     *
     * @param name the mode name
     * @return the store mode
     */
    public static StoreMode get(String name) {
        for (StoreMode sm : StoreMode.class.getEnumConstants()) {
            if (sm.name.equalsIgnoreCase(name)) {
                return sm;
            }
        }
        throw new IllegalArgumentException("unknown store 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 store.mode to a supported value (file, db, redis, raft — check your version's enum).
  2. Fix typos and ensure the property is not empty after env-var interpolation.
  3. Pre-validate with StoreMode.contains(name) and fail with a clear config error message.

Example fix

# before
store.mode=redis-cluster

# after
store.mode=redis
Defensive patterns

Strategy: validation

Validate before calling

String mode = System.getProperty("store.mode", "").trim();
if (!StoreMode.contains(mode)) {
    throw new IllegalArgumentException("store.mode must be one of file/db/redis/raft, got: '" + mode + "'");
}
StoreMode storeMode = StoreMode.get(mode);

Try / catch

try {
    StoreMode mode = StoreMode.get(name);
} catch (IllegalArgumentException e) {
    // unknown store mode value: surface allowed values and the raw config string
    throw e;
}

Prevention

When it happens

Trigger: Bootstrap reads store.mode (file.conf / application.yml / CLI arg) and calls StoreMode.get(value); value is null, empty, misspelled, or a non-mode string like 'mysql8', 'oracl', 'none'.

Common situations: Typo in store.mode in registry/file configuration; passing a store-mode string from an incompatible older seata version; empty environment variable interpolated to empty string; using a database nickname instead of 'db'.

Related errors


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