googleworkspace/cli · error · GwsError
Unsupported HTTP method: {other}
Error message
Unsupported HTTP method: {other} What it means
The executor maps each Discovery method's http_method string onto a reqwest builder and only knows GET, POST, PUT, PATCH, DELETE. A Discovery document that declares any other verb (HEAD, OPTIONS, or a newly introduced method) falls into the catch-all arm and is rejected with this error. In practice it signals a version skew: the fetched Discovery document is newer (or simply different) than the verb set the CLI's executor supports.
Source
Thrown at crates/google-workspace-cli/src/executor.rs:178
#[allow(clippy::too_many_arguments)]
async fn build_http_request(
client: &reqwest::Client,
method: &RestMethod,
input: &ExecutionInput,
token: Option<&str>,
auth_method: &AuthMethod,
page_token: Option<&str>,
pages_fetched: u32,
upload: &Option<UploadSource<'_>>,
) -> Result<reqwest::RequestBuilder, GwsError> {
let mut request = match method.http_method.as_str() {
"GET" => client.get(&input.full_url),
"POST" => client.post(&input.full_url),
"PUT" => client.put(&input.full_url),
"PATCH" => client.patch(&input.full_url),
"DELETE" => client.delete(&input.full_url),
other => {
return Err(GwsError::Other(anyhow::anyhow!(
"Unsupported HTTP method: {other}"
)))
}
};
if let Some(token) = token {
if *auth_method == AuthMethod::OAuth {
request = request.bearer_auth(token);
}
}
// Set quota project from ADC for billing/quota attribution
if let Some(quota_project) = crate::auth::get_quota_project() {
request = request.header("x-goog-user-project", quota_project);
}
let mut all_query_params = input.query_params.clone();
if let Some(pt) = page_token {View on GitHub (pinned to a3768d0e82)
Solutions
- Update gws to the latest release — the verb allowlist may already have been extended
- Inspect the method with `gws <service> schema` (or the Discovery JSON) to confirm which http_method it declares
- If a genuinely new verb is needed, file an issue/PR extending the match in executor.rs
Example fix
// before: hard failure on any unlisted verb
other => return Err(GwsError::Other(anyhow::anyhow!("Unsupported HTTP method: {other}"))),
// after (if the API truly needs it): extend the allowlist explicitly
"HEAD" => client.head(&input.full_url),
other => return Err(GwsError::Other(anyhow::anyhow!("Unsupported HTTP method: {other}"))), Defensive patterns
Strategy: validation
Validate before calling
// Validate the Discovery verb before building any request
const SUPPORTED: &[&str] = &["GET", "POST", "PUT", "PATCH", "DELETE"];
fn method_supported(m: &str) -> bool {
SUPPORTED.contains(&m)
} Type guard
fn is_supported_http_method(method: &str) -> bool {
matches!(method, "GET" | "POST" | "PUT" | "PATCH" | "DELETE")
} Prevention
- Pin/refresh the gws binary when Discovery documents change — version skew is the usual cause
- When registering a new service alias, smoke-test one method per resource to catch exotic verbs early
- Surface the method name in logs when this fires so users can report the exact offending verb
When it happens
Trigger: Google ships a Discovery revision using a verb outside the allowlist for some method; a cached Discovery document from a nonstandard source declares an unusual http_method; the service alias maps to an unexpected Discovery API.
Common situations: Long-running old gws binary against a freshly fetched Discovery doc; experimental/beta Google APIs surfacing new verbs; custom Discovery endpoints in tests.
Related errors
- Failed to fetch Discovery Document for {service}/{version}:
- Token refresh failed with status {}: {}
- Failed to list calendars: {e}
AI-assisted analysis of googleworkspace/cli@a3768d0e82 (2026-08-16).
Data as JSON: /api/errors/83d21b316a230178.
Report an issue: GitHub.