jlcodes99/cockpit-tools · error

官方 LS 返回错误: {} - {} ({})

Error message

官方 LS 返回错误: {} - {} ({})

What it means

HTTP failure mapping in the official Language Server wakeup gateway: a proxied request to the official LS returned a non-2xx status. The response body (truncated to 512 chars) is logged as '[WakeupGateway] 官方 LS 返回错误' and the message '官方 LS 返回错误: {} - {} ({})' carries the status, body preview, and path back to the caller as the mapped error result.

Source

Thrown at crates/cockpit-core/src/modules/wakeup_gateway.rs:1057

        .header("x-codeium-csrf-token", csrf_token)
        .json(body)
        .send()
        .await
        .map_err(|e| format!("官方 LS 请求失败: {} ({})", e, path))?;

    if !resp.status().is_success() {
        let status = resp.status();
        let text = resp.text().await.unwrap_or_default();
        let preview: String = text.chars().take(512).collect();
        crate::modules::logger::log_error(&format!(
            "[WakeupGateway] 官方 LS 返回错误: status={}, path={}, body_len={}, body={}",
            status,
            path,
            text.len(),
            preview
        ));
        return Err(format!(
            "官方 LS 返回错误: {} - {} ({})",
            status, text, path
        ));
    }

    resp.json::<Value>()
        .await
        .map_err(|e| format!("官方 LS 响应解析失败: {} ({})", e, path))
}

enum OfficialLsExtensionAction {
    Close(Vec<u8>),
    HoldStream {
        content_type: String,
        first_message: Vec<u8>,
        shutdown_notify: Arc<Notify>,
    },
}

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Read the interpolated status/body to identify the upstream cause (401 auth expiry, 429 rate limit, 5xx)
  2. Re-authenticate the account if the LS reports authorization failures
  3. Retry after backoff for transient 5xx/429 responses
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/cockpit-core/src/modules/wakeup_gateway.rs:1057 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/f8ac312e34b0c8cd. Report an issue: GitHub.