nikivdev/code · error
Maple MCP request failed ({}): {}
Error message
Maple MCP request failed ({}): {} What it means
This error is raised by `maple_json_rpc_request` in src/codex_telemetry.rs when the Maple MCP HTTP endpoint returns a non-success HTTP status. The library embeds the status code and the raw response body (JSON-serialized, falling back to 'unparseable error body') so the caller can see exactly why the server rejected the JSON-RPC request. It wraps the two earlier failure points (connection failure, JSON parse failure) with an explicit server-side rejection signal.
Source
Thrown at src/codex_telemetry.rs:406
.context("failed to build Maple MCP client")?;
let request = serde_json::json!({
"jsonrpc": "2.0",
"id": 1,
"method": method,
"params": params,
});
let response = client
.post(&config.endpoint)
.bearer_auth(&config.token)
.json(&request)
.send()
.with_context(|| format!("failed to reach Maple MCP at {}", config.endpoint))?;
let status = response.status();
let payload: serde_json::Value = response
.json()
.context("failed to parse Maple MCP response JSON")?;
if !status.is_success() {
anyhow::bail!(
"Maple MCP request failed ({}): {}",
status,
serde_json::to_string(&payload)
.unwrap_or_else(|_| "unparseable error body".to_string())
);
}
let envelope = if let Some(items) = payload.as_array() {
items.first().cloned().unwrap_or(serde_json::Value::Null)
} else {
payload
};
if let Some(error) = envelope.get("error") {
let code = error
.get("code")
.and_then(serde_json::Value::as_i64)
.unwrap_or(-1);
let message = error
.get("message")View on GitHub (pinned to a747e741ae)
Solutions
- Read the status and body in the message: fix auth (401/403) by exporting a valid MAPLE_API_TOKEN, fix the URL (404) by correcting the endpoint config, or retry later (5xx) once the Maple service is healthy.
- Verify connectivity with curl: `curl -i "$MAPLE_MCP_ENDPOINT"` and confirm the server responds at the configured path.
- Check that the Maple MCP server version supports the JSON-RPC method being invoked (maple_call_tool / trace_status).
- Inspect proxy environment variables (HTTP_PROXY/HTTPS_PROXY) that may intercept the request.
Example fix
// before: endpoint misconfigured MAPLE_MCP_ENDPOINT=http://localhost:9999/wrong // after MAPLE_MCP_ENDPOINT=http://localhost:8080/mcp
Defensive patterns
Strategy: try-catch
Validate before calling
// preflight the endpoint before making calls
let endpoint = std::env::var("MAPLE_MCP_ENDPOINT")?;
let ok = reqwest::Client::new()
.get(&endpoint)
.timeout(std::time::Duration::from_secs(5))
.send()
.map(|r| r.status().as_u16())
.map_err(|e| format!("unreachable: {e}"));
if let Ok(code) = &ok { if !(200..300).contains(code) { return Err(format!("endpoint unhealthy: {code}")); } } Type guard
fn is_success_response(resp: &reqwest::Response) -> bool { resp.status().is_success() } Try / catch
match maple_call_tool(name, args) {
Err(e) if e.to_string().contains("Maple MCP request failed (") => {
// parse the status out of the message; 401/403 -> refresh token, 5xx -> retry later
eprintln!("Maple endpoint rejected request: {e:#}");
}
Err(e) => return Err(e),
Ok(result) => result,
} Prevention
- Validate MAPLE_API_TOKEN and MAPLE_MCP_ENDPOINT with a cheap health check before batch operations
- Log the HTTP status and body on every Maple call
- Monitor Maple service health/uptime before long telemetry runs
- Pin and document the expected MCP server version
When it happens
Trigger: `maple_json_rpc_request` (called by `maple_call_tool` and `trace_status`) receives an HTTP response whose status is not a success (e.g. 401 Unauthorized from a bad/missing MAPLE_API_TOKEN, 404 from a wrong endpoint path, 500 from a Maple server fault), and bails with the status plus body.
Common situations: Expired or missing MAPLE_API_TOKEN, misconfigured MAPLE_MCP_ENDPOINT pointing at the wrong port/path, Maple MCP service down or restarting, proxy/firewall returning an error page, or a version mismatch where the endpoint no longer accepts a given JSON-RPC method.
Related errors
- Maple MCP error {code}: {message}
- hub returned error: {}
- API error {}: {}
- LM Studio returned status {}: {}
- gitedit publish failed: HTTP {}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/2d45dbfb57ca9811.
Report an issue: GitHub.