abhigyanpatwari/GitNexus · critical
-32000
-32000
Error message
Internal MCP server error
What it means
JSON-RPC error response (code -32000, message 'Internal MCP server error', id null) returned by the /api/mcp streamable-HTTP endpoint when the MCP handler itself throws or rejects. It is the MCP surface's equivalent of an unhandled exception: the real failure is logged as 'MCP HTTP request failed:'; if headers were already sent (failure mid-stream) no error body can be written and the HTTP stream simply terminates.
Source
Thrown at gitnexus/src/server/mcp-http.ts:28
import type { Express, Request, Response } from 'express';
import { createStreamableHttpHandler } from '../mcp/http-transport.js';
import type { LocalBackend } from '../mcp/local/local-backend.js';
import { createMcpRepositoryPolicy } from '../mcp/repository-policy.js';
import { logger } from '../core/logger.js';
export async function mountMCPEndpoints(
app: Express,
backend: LocalBackend,
): Promise<() => Promise<void>> {
const repositoryPolicy = await createMcpRepositoryPolicy(backend);
const { handler, cleanup } = createStreamableHttpHandler(backend, { repositoryPolicy });
app.all('/api/mcp', (req: Request, res: Response) => {
void handler(req, res).catch((err: unknown) => {
logger.error({ err }, 'MCP HTTP request failed:');
if (res.headersSent) return;
res.status(500).json({
jsonrpc: '2.0',
error: { code: -32000, message: 'Internal MCP server error' },
id: null,
});
});
});
logger.info('MCP HTTP endpoints mounted at /api/mcp');
return cleanup;
}
View on GitHub (pinned to aac7515d2a)
Solutions
- Check the serve logs for 'MCP HTTP request failed:' — the -32000 body carries no detail by design
- Let the client re-initialize the MCP session (most do automatically) and retry the tool call once
- Re-run analyze to rebuild the index if storage corruption is suspected
- Persistent -32000 with a reproducible request is a bug — update GitNexus and report with the stack
Example fix
// before
const result = await client.callTool({ name: 'impact', arguments: args }); // throws on -32000
// after
async function callMcpSafe(client: any, name: string, args: object) {
try {
return await client.callTool({ name, arguments: args });
} catch (e: any) {
if (e?.code === -32000) {
await client.connect(); // re-initialize the session
return client.callTool({ name, arguments: args });
}
throw e;
}
} Defensive patterns
Strategy: retry
Try / catch
Catch JSON-RPC errors with code -32000, log context client-side, re-initialize the MCP session, and retry the call exactly once; escalate to the serve log if it persists.
Prevention
- Keep serve logs visible when integrating MCP clients
- Rebuild the index (analyze) after version upgrades
- Treat -32000 as transient-first, bug-second
When it happens
Trigger: A backend crash while servicing tools/list or tools/call; corrupted or version-skewed index/storage touched during a tool call; a GitNexus bug in the streamable-HTTP handler; the server dying mid-request and leaving a half-written response.
Common situations: Editor/MCP clients attached to a serve instance with corrupted storage; concurrent MCP sessions racing index re-initialization; upgrades leaving the index in an incompatible state.
Related errors
- Failed to start analysis
- Failed to start embedding generation
- Missing Content-Length header from MCP client
- Invalid Content-Length header from MCP client
- Content-Length ${contentLength} exceeds maximum allowed size
AI-assisted analysis of abhigyanpatwari/GitNexus@aac7515d2a (2026-08-20).
Data as JSON: /api/errors/3a3f8f56745e9a5b.
Report an issue: GitHub.