github/copilot-sdk · error · IllegalArgumentException

Unknown AutoTier value: + value

Error message

Unknown AutoTier value: + value

What it means

AutoTier.fromValue maps a string to the AutoTier enum. If the value matches no enum constant, it throws IllegalArgumentException with the raw value included. This surfaces unsupported or misspelled tier names from configuration or protocol messages.

Solutions

  1. Inspect AutoTier.values() and correct the value to an accepted constant.
  2. Upgrade the SDK if the tier was added in a newer release.
  3. Validate user/config input against the known values before calling fromValue.
  4. Catch IllegalArgumentException and fall back to a sensible default tier.

Example fix

// before
AutoTier tier = AutoTier.fromValue(cfg.tier());

// after
AutoTier tier;
try {
    tier = AutoTier.fromValue(cfg.tier());
} catch (IllegalArgumentException e) {
    tier = AutoTier.NONE;
}
Defensive patterns

Strategy: validation

Validate before calling

static boolean isKnownAutoTier(String v) {
    for (AutoTier t : AutoTier.values()) {
        if (t.name().equalsIgnoreCase(v)) return true;
    }
    return false;
}

Try / catch

try {
    tier = AutoTier.fromValue(value);
} catch (IllegalArgumentException e) {
    tier = AutoTier.NONE;
}

Prevention

When it happens

Trigger: Calling AutoTier.fromValue with a tier string not among the enum's values — typos, wrong casing, numeric tier strings where names are expected, or tiers from a newer API version.

Common situations: Config files naming a tier that the installed SDK doesn't know; server sending a newly introduced tier; users writing "auto" vs the exact enum value.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/f924fd3dbbd8b7aa. Report an issue: GitHub.

Appendix: source

Thrown at java/sdk/src/main/java/com/github/copilot/rpc/AutoTier.java:61

     * Deserializes a JSON string into its routing tier.
     *
     * @param value
     *            the JSON string value
     * @return the matching tier, or {@code null} if value is {@code null}
     * @throws IllegalArgumentException
     *             if the value does not match a known routing tier
     */
    @JsonCreator
    public static AutoTier fromValue(String value) {
        if (value == null) {
            return null;
        }
        for (AutoTier tier : values()) {
            if (tier.value.equals(value)) {
                return tier;
            }
        }
        throw new IllegalArgumentException("Unknown AutoTier value: " + value);
    }
}

View on GitHub (pinned to cd8cf15dc3)