{"record":{"id":"c32832c90bbfe54b","repo":"openai/codex","slug":"method-failed","errorCode":null,"errorMessage":"{method} failed: {}","messagePattern":"(.+?) failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/app-server-daemon/src/remote_control_client.rs","lineNumber":244,"sourceCode":"        let message = timeout(\n            client::CONTROL_SOCKET_RESPONSE_TIMEOUT,\n            client::read_message(websocket),\n        )\n        .await\n        .with_context(|| format!(\"timed out waiting for {method} response\"))??;\n        match message {\n            JSONRPCMessage::Response(response) if response.id == *request_id => {\n                let response = serde_json::from_value::<T>(response.result)\n                    .with_context(|| format!(\"failed to parse {method} response\"))?;\n                return Ok(RemoteControlRpcResponse::Success(response));\n            }\n            JSONRPCMessage::Error(err)\n                if err.id == *request_id && err.error.code == INVALID_PARAMS_ERROR_CODE =>\n            {\n                return Ok(RemoteControlRpcResponse::InvalidParams);\n            }\n            JSONRPCMessage::Error(err) if err.id == *request_id => {\n                return Err(anyhow!(\"{method} failed: {}\", err.error.message));\n            }\n            JSONRPCMessage::Notification(notification)\n                if remote_control_status_notification(&notification).is_some() =>\n            {\n                continue;\n            }\n            _ => {}\n        }\n    }\n}\n\nasync fn wait_for_remote_control_status<S>(\n    websocket: &mut WebSocketStream<S>,\n    mut latest: RemoteControlReadyStatus,\n    ready_timeout: Duration,\n) -> Result<RemoteControlReadyStatus>\nwhere\n    S: AsyncRead + AsyncWrite + Unpin,","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/app-server-daemon/src/remote_control_client.rs#L226-L262","documentation":"Generic passthrough for a failed remote-control RPC. While waiting for the reply to remoteControl/enable, remoteControl/disable, or remoteControl/pairing/start, read_remote_control_response converts any JSON-RPC error response whose id matches the request into this anyhow error, embedding the server's own message. The -32602 code is exempt because the caller consumes it as the legacy-fallback signal; every other error code lands here.","triggerScenarios":"The app-server returns a non-(-32602) JSON-RPC error for the matching request id: -32601 method-not-found on builds without remoteControl support, internal errors from the remote-control subsystem, or server-side validation failures during enable, disable, or manual pairing start.","commonSituations":"Pointing the daemon at an older or different app-server build that lacks remoteControl methods; remote-control backend outages (relay, environment binding, auth); test servers that emit error responses with the correct request id.","solutions":["Read the embedded message: it is the server's verbatim error text and names the actual cause; fix that cause (method not found means the server build lacks remoteControl, for example).","If the server message says the method is unknown or unsupported, switch to or upgrade an app-server build that implements the remoteControl API.","Confirm the daemon connected to the intended socket path; a stale daemon or a foreign process on the socket produces surprising errors.","For server-side backend errors (auth, relay, environment), resolve the underlying condition and re-issue the request; the client has nothing local to repair."],"exampleFix":"// before\nlet response = start_pairing(&socket_path).await?; // Err: remoteControl/pairing/start failed: <server message>\n\n// after\nlet response = match start_pairing(&socket_path).await {\n    Ok(response) => response,\n    Err(err) => {\n        if let Some((_, server_msg)) = err.to_string().split_once(\" failed: \") {\n            tracing::error!(server_msg, \"pairing rejected by app-server\");\n        }\n        return Err(err);\n    }\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(err) = enable_remote_control(&socket_path).await {\n    let text = err.to_string();\n    if text.starts_with(\"remoteControl/\") && text.contains(\" failed: \") {\n        // Server-originated JSON-RPC error: log the embedded message and\n        // debug the app-server side; do not blind-retry the same request.\n        tracing::warn!(error = text, \"remote control RPC failed server-side\");\n    }\n}","preventionTips":["Treat any 'remoteControl/... failed: <msg>' text as server-side; investigate the app-server, not the transport.","Run the app-server with logging enabled to correlate returned error messages with their origin.","Keep daemon and app-server versions matched so method-not-found errors cannot appear.","In mock servers, always echo the request id in replies; mismatched ids make the client wait until timeout instead."],"tags":["remote-control","json-rpc","error-response","websocket","app-server-daemon"],"backgroundTag":"json-rpc-error-response","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}