koala73/worldmonitor · error

Initialize error: ${initData.error.message}

Error message

Initialize error: ${initData.error.message}

What it means

Thrown during MCP session bootstrap when the initialize request succeeded at the HTTP level but the JSON-RPC response payload carried a top-level error object. The MCP server itself reported a protocol-level failure (unsupported protocol version, malformed init payload, server-side refusal), distinct from a transport/HTTP failure.

Source

Thrown at api/mcp-proxy.ts:317

  try {
    await postJson(serverUrl, {
      jsonrpc: '2.0',
      method: 'notifications/initialized',
      params: {},
    }, headers, sessionId);
  } catch (error) {
    if (error instanceof McpProxySsrfError) throw error;
    /* non-fatal */
  }
}

async function mcpListTools(serverUrl, customHeaders) {
  const headers = buildHeaders(customHeaders);
  const initResp = await postJson(serverUrl, buildInitPayload(), headers, null);
  if (!initResp.ok) throw new Error(`Initialize failed: HTTP ${initResp.status}`);
  const sessionId = initResp.headers.get('Mcp-Session-Id') || initResp.headers.get('mcp-session-id');
  const initData = await parseJsonRpcResponse(initResp);
  if (initData.error) throw new Error(`Initialize error: ${initData.error.message}`);
  await sendInitialized(serverUrl, headers, sessionId);
  const listResp = await postJson(serverUrl, {
    jsonrpc: '2.0', id: 2, method: 'tools/list', params: {},
  }, headers, sessionId);
  if (!listResp.ok) throw new Error(`tools/list failed: HTTP ${listResp.status}`);
  const listData = await parseJsonRpcResponse(listResp);
  if (listData.error) throw new Error(`tools/list error: ${listData.error.message}`);
  return listData.result?.tools || [];
}

async function mcpCallTool(serverUrl, toolName, toolArgs, customHeaders) {
  const headers = buildHeaders(customHeaders);
  const initResp = await postJson(serverUrl, buildInitPayload(), headers, null);
  if (!initResp.ok) throw new Error(`Initialize failed: HTTP ${initResp.status}`);
  const sessionId = initResp.headers.get('Mcp-Session-Id') || initResp.headers.get('mcp-session-id');
  const initData = await parseJsonRpcResponse(initResp);
  if (initData.error) throw new Error(`Initialize error: ${initData.error.message}`);
  await sendInitialized(serverUrl, headers, sessionId);

View on GitHub (pinned to 9361220cc0)

Solutions

  1. Read the embedded error.message: it is the upstream MCP server's own protocol error text
  2. Confirm the client's protocolVersion and clientInfo in the initialize payload are accepted by the server
  3. Update or reconfigure the MCP server if it rejects the negotiated protocol version
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at api/mcp-proxy.ts:315 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of koala73/worldmonitor@9361220cc0 (2026-08-21). Data as JSON: /api/errors/29558efd908f029d. Report an issue: GitHub.