{"record":{"id":"450b8e943aabe98f","repo":"googleapis/mcp-toolbox","slug":"request-body-exceeds-d-bytes-450b8e","errorCode":null,"errorMessage":"request body exceeds %d bytes","messagePattern":"request body exceeds (.+?) bytes","errorType":"http","errorClass":"jsonrpc PARSE_ERROR","httpStatus":null,"severity":"error","filePath":"internal/server/mcp.go","lineNumber":532,"sourceCode":"\t\t\turlParams[k] = v[0]\n\t\t}\n\t}\n\tif len(urlParams) > 0 {\n\t\tctx = util.WithUrlParams(ctx, urlParams)\n\t}\n\n\tlimit := s.httpMaxRequestBytes\n\tr.Body = http.MaxBytesReader(w, r.Body, limit)\n\n\t// Read body first so we can extract trace context\n\tbody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\t// The id cannot be determined from an unreadable body. Per JSON-RPC 2.0,\n\t\t// the response id MUST be null in that case.\n\t\t// See https://www.jsonrpc.org/specification#response_object\n\t\tvar maxErr *http.MaxBytesError\n\t\tif errors.As(err, &maxErr) {\n\t\t\terr = fmt.Errorf(\"request body exceeds %d bytes\", limit)\n\t\t}\n\t\ts.logger.DebugContext(ctx, err.Error())\n\t\trender.JSON(w, r, jsonrpc.NewError(nil, jsonrpc.PARSE_ERROR, err.Error(), nil))\n\t\treturn\n\t}\n\n\t// This ensures the transport span becomes a child of the client span\n\t// _meta.ProtocolVersion is not checked here for http transport.\n\t_, ctx = extractMeta(ctx, body)\n\n\t// Create span for HTTP transport\n\tctx, span := s.instrumentation.Tracer.Start(ctx, \"toolbox/server/mcp/http\",\n\t\ttrace.WithSpanKind(trace.SpanKindServer),\n\t)\n\tr = r.WithContext(ctx)\n\n\tvar sessionId, protocolVersion string\n\tvar session *sseSession","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/mcp.go#L514-L550","documentation":"Error \"request body exceeds %d bytes\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/server/mcp.go:532 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}