quarkusio/quarkus · error · RuntimeException

unknown mode:

Error message

unknown mode:

What it means

BootstrapProfile.getActiveProfile maps a LaunchMode (NORMAL, DEV, TEST, etc.) to a bootstrap profile (TEST, DEV, PROD). The default branch throws a RuntimeException "unknown mode:" for any LaunchMode value it has no mapping for — i.e. an unhandled enum constant such as REMOTE_DEV or DEVELOPMENT variants not covered by the switch.

Source

Thrown at independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/BootstrapProfile.java:62

        if (profile != null) {
            return profile;
        }

        profile = runtimeDefaultProfile;
        if (profile != null) {
            return profile;
        }
        switch (mode) {
            case REMOTE_DEV_SERVER:
            case DEV:
            case CONTINUOUS_TEST:
                return DEV;
            case REMOTE_DEV_CLIENT:
            case PROD:
            case RUN:
                return PROD;
            default:
                throw new RuntimeException("unknown mode:" + mode);
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Upgrade quarkus-bootstrap so it covers the LaunchMode constants in use
  2. Pass one of the supported modes: NORMAL, DEV, TEST, PROD, REMOTE_DEV_CLIENT
  3. Check for version skew between the bootstrap core jar and quarkus-core that define LaunchMode

Example fix

// before
builder.setLaunchMode(LaunchMode.REMOTE_DEV);
// after
builder.setLaunchMode(LaunchMode.NORMAL); // or upgrade bootstrap to map REMOTE_DEV
Defensive patterns

Strategy: validation

Validate before calling

LaunchMode mode = LaunchMode.DEV;
Set<LaunchMode> supported = Set.of(LaunchMode.NORMAL, LaunchMode.DEV, LaunchMode.TEST, LaunchMode.PROD, LaunchMode.REMOTE_DEV_CLIENT);
if (!supported.contains(mode)) throw new IllegalArgumentException("Unsupported mode: " + mode);

Try / catch

try {
    profile = BootstrapProfile.getActiveProfile(mode);
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("unknown mode:")) { /* fall back to LaunchMode.NORMAL */ }
}

Prevention

When it happens

Trigger: Calling getActiveProfile with a LaunchMode not listed in the switch cases (e.g. REMOTE_DEV itself, newer LaunchMode constants added after this code was written, or a null/custom mode).

Common situations: Using a newer Quarkus LaunchMode enum with an older bootstrap library (version skew), passing LaunchMode.REMOTE_DEV where only client/prod are handled, or reflection/manual invocation of the bootstrap API with an exotic mode.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/373e85bf03d0f943. Report an issue: GitHub.