github/copilot-sdk · error · IllegalArgumentException
Unknown WorkspaceDiffFileChangeType value
Error message
Unknown WorkspaceDiffFileChangeType value: ${value} What it means
WorkspaceDiffFileChangeType.fromValue is the Jackson @JsonCreator used to deserialize a string into the enum. It iterates all declared enum constants and throws IllegalArgumentException when no constant's value matches the input string. This happens when the wire payload carries a change-type string the SDK's generated enum does not know (older/newer CLI version mismatch).
Solutions
- Upgrade the Copilot Java SDK to a version whose generated WorkspaceDiffFileChangeType includes the new value.
- Log the offending value (from the exception message) and check the SDK enum values for the expected constant.
- Sanitize/normalize the incoming string before deserialization if it comes from your own code.
Defensive patterns
Strategy: try-catch
Validate before calling
Set<WorkspaceDiffFileChangeType> known = EnumSet.allOf(WorkspaceDiffFileChangeType.class);
if (raw != null && known.stream().noneMatch(v -> v.getValue().equals(raw))) {
log.warn("Unsupported diff change type: {}", raw);
} Try / catch
try {
WorkspaceDiffFileChangeType t = WorkspaceDiffFileChangeType.fromValue(raw);
} catch (IllegalArgumentException e) {
log.warn("Ignoring unknown change type: {}", raw);
} Prevention
- Keep the Java SDK version aligned with the CLI version.
- Log-and-skip unknown enum strings on non-critical event paths.
- Pin dependency versions and regenerate generated enums on upgrades.
When it happens
Trigger: Deserializing a JSON payload (e.g. workspace diff file change events) whose change-type field contains a string not present among the generated enum constants.
Common situations: CLI/server updated to emit a new diff change type while the Java SDK is an older generated version; manual construction with a typo'd value; passing raw strings from another API.
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
- Unknown WorkspaceDiffMode value
- Unknown WorkspaceSummaryHostType value
- Unknown WorkspacesWorkspaceDetailsHostType value
- Unknown AgentMode value: + value
- Unknown AskUserVariant value: + value
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/e0ddf40d3662fa6b.
Report an issue: GitHub.
Appendix: source
Thrown at java/sdk/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffFileChangeType.java:37
/** The {@code added} variant. */
ADDED("added"),
/** The {@code modified} variant. */
MODIFIED("modified"),
/** The {@code deleted} variant. */
DELETED("deleted"),
/** The {@code renamed} variant. */
RENAMED("renamed");
private final String value;
WorkspaceDiffFileChangeType(String value) { this.value = value; }
@com.fasterxml.jackson.annotation.JsonValue
public String getValue() { return value; }
@com.fasterxml.jackson.annotation.JsonCreator
public static WorkspaceDiffFileChangeType fromValue(String value) {
for (WorkspaceDiffFileChangeType v : values()) {
if (v.value.equals(value)) return v;
}
throw new IllegalArgumentException("Unknown WorkspaceDiffFileChangeType value: " + value);
}
}
View on GitHub (pinned to cd8cf15dc3)