{"record":{"id":"5b1672ca2f316d1e","repo":"googleworkspace/cli","slug":"5-5b1672","errorCode":"5","errorMessage":"Failed to fetch account timezone: {e}","messagePattern":"Failed to fetch account timezone: (.+?)","errorType":"exception","errorClass":"GwsError","httpStatus":null,"severity":"warning","filePath":"crates/google-workspace-cli/src/timezone.rs","lineNumber":85,"sourceCode":"        if let Err(e) = std::fs::create_dir_all(parent) {\n            tracing::warn!(path = %parent.display(), error = %e, \"failed to create timezone cache directory\");\n            return;\n        }\n    }\n    if let Err(e) = std::fs::write(&path, tz_name) {\n        tracing::warn!(path = %path.display(), error = %e, \"failed to write timezone cache\");\n    }\n}\n\n/// Fetch the account timezone from the Google Calendar Settings API.\nasync fn fetch_account_timezone(client: &reqwest::Client, token: &str) -> Result<Tz, GwsError> {\n    let url = \"https://www.googleapis.com/calendar/v3/users/me/settings/timezone\";\n    let resp = client\n        .get(url)\n        .bearer_auth(token)\n        .send()\n        .await\n        .map_err(|e| GwsError::Other(anyhow::anyhow!(\"Failed to fetch account timezone: {e}\")))?;\n\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp.text().await.unwrap_or_default();\n        return Err(GwsError::Api {\n            code: status.as_u16(),\n            message: body,\n            reason: \"timezone_fetch_failed\".to_string(),\n            enable_url: None,\n        });\n    }\n\n    let json: serde_json::Value = resp\n        .json()\n        .await\n        .map_err(|e| GwsError::Other(anyhow::anyhow!(\"Failed to parse timezone response: {e}\")))?;\n\n    let tz_name = json","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/googleworkspace/cli/blob/a3768d0e82ad83cca2da97724e46bea4ff0e6dbd/crates/google-workspace-cli/src/timezone.rs#L67-L103","documentation":"`fetch_account_timezone()`'s GET to `https://www.googleapis.com/calendar/v3/users/me/settings/timezone` failed at the transport layer (DNS, connection, TLS, proxy) before any status code existed. Note this is a *soft* failure in practice: `resolve_account_timezone()` catches it, logs a warning, and falls back to the machine-local timezone (step 4 of its priority chain), so the command usually still completes — possibly with wrong-day boundaries for users whose machine tz differs from their calendar tz.","triggerScenarios":"First run of a date-aware helper (`+standup-report`, `+focus`, etc.) with no timezone cache and no `--timezone` flag while offline or behind a broken proxy; DNS failure for www.googleapis.com; ADC/service environments without external egress.","commonSituations":"Egress-restricted CI; cached timezone older than 24h expiring exactly when the network is down; machines set to UTC while the Google account lives in another zone (silent boundary shift after fallback).","solutions":["Pass `--timezone America/Denver` (any IANA name) — priority 1, skips the network fetch entirely.","Restore egress to www.googleapis.com and retry; a successful fetch repopulates the 24h cache.","Check proxy env vars if a middlebox is breaking the request.","If you rely on calendar-day accuracy in automation, always set --timezone explicitly rather than depending on the silent local-machine fallback."],"exampleFix":"# before — silent fallback to machine tz when offline\nGOOGLE_WORKSPACE_CLI_LOG=warn gws calendar +standup-report\n# stderr: failed to fetch account timezone, falling back to local\n\n# after — pin the zone, no fetch needed\ngws calendar +standup-report --timezone Europe/Berlin","handlingStrategy":"fallback","validationCode":"// Skip the network fetch when the zone is known\nif let Some(tz) = std::env::var(\"GWS_TZ\").ok() {\n    args.push(format!(\"--timezone={tz}\")); // priority-1 override, no HTTP call\n}","typeGuard":null,"tryCatchPattern":"// resolve_account_timezone already implements the recommended pattern:\n// fetch failure -> warn -> machine-local fallback. Wrap callers to surface it:\nmatch timezone::resolve_account_timezone(&client, &token, override_tz).await {\n    Ok(tz) => tz,\n    Err(e) => chrono_tz::UTC, // belt-and-braces: never fail a report for timezone reasons\n}","preventionTips":["Pass --timezone explicitly in scheduled reports so results never depend on network availability.","Keep the machine timezone correct — it is the silent fallback.","Watch for the 'falling back to local' warning in stderr when accuracy matters."],"tags":["timezone","network","calendar-api","fallback"],"backgroundTag":"http-connection-error","analyzedSha":"a3768d0e82ad83cca2da97724e46bea4ff0e6dbd","analyzedAt":"2026-08-16T19:51:46.516Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}