github/copilot-sdk · error · IllegalArgumentException
Unknown WorkspacesWorkspaceDetailsHostType value
Error message
Unknown WorkspacesWorkspaceDetailsHostType value: ${value} What it means
WorkspacesWorkspaceDetailsHostType.fromValue is the Jackson @JsonCreator for the WorkspacesWorkspaceDetailsHostType enum. It throws IllegalArgumentException when the supplied string matches no declared constant. This indicates the SDK received a workspace-details host-type value it cannot map.
Solutions
- Update the Java SDK to a version whose generated enum covers the new host type.
- Read the unknown value from the exception message and compare with the enum constants.
- Pin CLI and SDK versions together to avoid generated-enum drift.
Defensive patterns
Strategy: try-catch
Validate before calling
boolean known = Stream.of(WorkspacesWorkspaceDetailsHostType.values()).anyMatch(v -> v.getValue().equals(raw));
if (!known) log.warn("Unsupported workspace host type: {}", raw); Try / catch
try {
WorkspacesWorkspaceDetailsHostType t = WorkspacesWorkspaceDetailsHostType.fromValue(raw);
} catch (IllegalArgumentException e) {
log.warn("Unknown workspace host type '{}'", raw);
} Prevention
- Pin CLI and SDK versions to matching releases.
- Treat unknown host types as non-fatal with a default/unknown fallback.
- Regenerate RPC enums whenever the protocol schema changes.
When it happens
Trigger: Deserializing a workspaces workspace-details payload with an unrecognized hostType string, or invoking fromValue directly with a value outside the generated enum.
Common situations: SDK/CLI version mismatch where the server emits a newly added host type; manual string construction with typos; proxy layers rewriting values.
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 WorkspaceDiffFileChangeType value
- Unknown WorkspaceDiffMode value
- Unknown WorkspaceSummaryHostType 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/c842cd052920f06d.
Report an issue: GitHub.
Appendix: source
Thrown at java/sdk/src/generated/java/com/github/copilot/generated/rpc/WorkspacesWorkspaceDetailsHostType.java:33
* @since 1.0.0
*/
@javax.annotation.processing.Generated("copilot-sdk-codegen")
public enum WorkspacesWorkspaceDetailsHostType {
/** The {@code github} variant. */
GITHUB("github"),
/** The {@code ado} variant. */
ADO("ado");
private final String value;
WorkspacesWorkspaceDetailsHostType(String value) { this.value = value; }
@com.fasterxml.jackson.annotation.JsonValue
public String getValue() { return value; }
@com.fasterxml.jackson.annotation.JsonCreator
public static WorkspacesWorkspaceDetailsHostType fromValue(String value) {
for (WorkspacesWorkspaceDetailsHostType v : values()) {
if (v.value.equals(value)) return v;
}
throw new IllegalArgumentException("Unknown WorkspacesWorkspaceDetailsHostType value: " + value);
}
}
View on GitHub (pinned to cd8cf15dc3)