jlcodes99/cockpit-tools · error

[WakeupGateway] 官方 LS SubscribeToUnifiedStateSyncTopic 解析失败:

Error message

[WakeupGateway] 官方 LS SubscribeToUnifiedStateSyncTopic 解析失败: {}

What it means

Parse guard in the official LS extension RPC bridge: a SubscribeToUnifiedStateSyncTopic connect request failed parse_subscribe_topic_from_connect_body, meaning the topic could not be extracted from the request body. The error is logged as '[WakeupGateway] ... 解析失败' and a 400 Bad Request text response is returned; the subscription is not registered.

Source

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

                crate::modules::logger::log_error(&format!(
                    "[WakeupGateway] 官方 LS LanguageServerStarted 解析失败: {}",
                    err
                ));
                return OfficialLsExtensionAction::Close(text_response(
                    400,
                    "Bad Request",
                    &err,
                    "text/plain; charset=utf-8",
                ));
            }
        }
    }

    if path_matches_rpc_method(&path, "SubscribeToUnifiedStateSyncTopic") {
        let topic = match parse_subscribe_topic_from_connect_body(&parsed.body) {
            Ok(v) => v,
            Err(err) => {
                crate::modules::logger::log_error(&format!(
                    "[WakeupGateway] 官方 LS SubscribeToUnifiedStateSyncTopic 解析失败: {}",
                    err
                ));
                return OfficialLsExtensionAction::Close(text_response(
                    400,
                    "Bad Request",
                    &err,
                    "text/plain; charset=utf-8",
                ));
            }
        };

        let topic_bytes = match topic.as_str() {
            "uss-oauth" => &state.uss_oauth_topic_bytes,
            "uss-enterprisePreferences" | "uss-agentPreferences" => &state.empty_topic_bytes,
            _ => &state.empty_topic_bytes,
        };
        let update = build_unified_state_sync_update_initial_state(topic_bytes);

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Verify the connect body carries the expected topic field/format
  2. Update parse_subscribe_topic_from_connect_body if the official LS changed its connect payload
  3. Use the logged parse error to pinpoint the malformed field
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/cockpit-core/src/modules/wakeup_gateway.rs:1206 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/7029286f2ebd22e5. Report an issue: GitHub.