github/copilot-sdk · error · IllegalArgumentException

Unknown WorkspaceSummaryHostType value

Error message

Unknown WorkspaceSummaryHostType value: ${value}

What it means

WorkspaceSummaryHostType.fromValue is the Jackson @JsonCreator for the WorkspaceSummaryHostType enum, throwing IllegalArgumentException when no enum constant's value matches the input string. The SDK cannot deserialize a host-type string that its generated enum does not declare.

Solutions

  1. Upgrade the Copilot Java SDK so WorkspaceSummaryHostType includes the reported host type.
  2. Check the unknown value in the exception message against the enum's declared constants.
  3. Normalize casing/spelling if the value originates in your own code.
Defensive patterns

Strategy: try-catch

Validate before calling

boolean known = Stream.of(WorkspaceSummaryHostType.values()).anyMatch(v -> v.getValue().equals(raw));
if (!known) log.warn("Unsupported host type: {}", raw);

Try / catch

try {
  WorkspaceSummaryHostType t = WorkspaceSummaryHostType.fromValue(raw);
} catch (IllegalArgumentException e) {
  log.warn("Unknown host type '{}'", raw);
}

Prevention

When it happens

Trigger: Deserializing a workspace summary whose hostType field is a string absent from the generated WorkspaceSummaryHostType constants, or calling fromValue directly with an unknown value.

Common situations: A newer CLI/server reports a host type (e.g. a newly supported editor) that the older generated SDK enum lacks; hand-written strings with wrong casing.

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/18cb78f48c2716b8. Report an issue: GitHub.

Appendix: source

Thrown at java/sdk/src/generated/java/com/github/copilot/generated/rpc/WorkspaceSummaryHostType.java:33

 * @since 1.0.0
 */
@javax.annotation.processing.Generated("copilot-sdk-codegen")
public enum WorkspaceSummaryHostType {
    /** The {@code github} variant. */
    GITHUB("github"),
    /** The {@code ado} variant. */
    ADO("ado");

    private final String value;
    WorkspaceSummaryHostType(String value) { this.value = value; }
    @com.fasterxml.jackson.annotation.JsonValue
    public String getValue() { return value; }
    @com.fasterxml.jackson.annotation.JsonCreator
    public static WorkspaceSummaryHostType fromValue(String value) {
        for (WorkspaceSummaryHostType v : values()) {
            if (v.value.equals(value)) return v;
        }
        throw new IllegalArgumentException("Unknown WorkspaceSummaryHostType value: " + value);
    }
}

View on GitHub (pinned to cd8cf15dc3)