rohitg00/ai-engineering-from-scratch · error · RpcProblem

-32602

-32602

Error message

params must be an object

What it means

Error "params must be an object" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/19-capstone-projects/13-mcp-server-with-registry/code/ts/src/protocol.ts:119

function complete(
  payload: Record<string, unknown>,
  cache?: { ttlMs: number; cacheScope: "public" | "private" },
): Record<string, unknown> {
  const result: Record<string, unknown> = {
    resultType: "complete",
    ...payload,
    _meta: { [SERVER_INFO_KEY]: { ...SERVER_INFO } },
  };
  if (cache) {
    result.ttlMs = cache.ttlMs;
    result.cacheScope = cache.cacheScope;
  }
  return result;
}

function validateRequest(msg: JsonRpcRequest): Record<string, unknown> {
  if (!isRecord(msg.params)) {
    throw new RpcProblem(-32602, "params must be an object");
  }
  const meta = msg.params._meta;
  if (!isRecord(meta)) {
    throw new RpcProblem(-32602, "params._meta is required");
  }
  const requested = meta[PROTOCOL_VERSION_KEY];
  if (typeof requested !== "string") {
    throw new RpcProblem(-32602, `${PROTOCOL_VERSION_KEY} is required`);
  }
  if (!(SUPPORTED_VERSIONS as readonly string[]).includes(requested)) {
    throw new RpcProblem(-32022, "Unsupported protocol version", {
      supported: [...SUPPORTED_VERSIONS],
      requested,
    });
  }
  if (!isRecord(meta[CLIENT_CAPABILITIES_KEY])) {
    throw new RpcProblem(-32602, `${CLIENT_CAPABILITIES_KEY} is required`);
  }

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/19-capstone-projects/13-mcp-server-with-registry/code/ts/src/protocol.ts:119 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26). Data as JSON: /api/errors/4cba4a5c9897c232. Report an issue: GitHub.