{"record":{"id":"064f1de3e35cc930","repo":"paperclipai/paperclip","slug":"gateway-not-found","errorCode":"gateway_not_found","errorMessage":"MCP gateway not found","messagePattern":"MCP gateway not found","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":404,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":3481,"sourceCode":"    const currentParameters = await governedToolArguments(session, tool, reviewedParameters);\n    return stableSerialize(currentParameters) === stableSerialize(reviewedParameters);\n  }\n\n  async function resolveConnectedLocalStdioTool(session: ToolGatewaySession, tool: ToolGatewayDescriptor) {\n    if (tool.providerType !== \"mcp_local_stdio\" || !tool.connectionId || !tool.catalogEntryId) {\n      throw new ToolGatewayHttpError(404, `Tool \"${tool.name}\" not found`, \"tool_not_found\");\n    }\n    const [entry] = await db\n      .select()\n      .from(toolCatalogEntries)\n      .where(and(\n        eq(toolCatalogEntries.id, tool.catalogEntryId),\n        eq(toolCatalogEntries.companyId, session.companyId),\n      ))\n      .limit(1);\n    if (!entry || entry.status !== \"active\" || entry.entryKind !== \"tool\") {\n      throw new ToolGatewayHttpError(404, `Tool \"${tool.name}\" not found`, \"tool_not_found\");\n    }\n    const [connection] = await db\n      .select()\n      .from(toolConnections)\n      .where(and(\n        eq(toolConnections.id, entry.connectionId),\n        eq(toolConnections.companyId, session.companyId),\n      ))\n      .limit(1);\n    if (!connection || connection.transport !== \"local_stdio\") {\n      throw new ToolGatewayHttpError(404, `Tool \"${tool.name}\" not found`, \"tool_not_found\");\n    }\n    if (!connection.enabled || connection.status !== \"active\") {\n      throw new ToolGatewayHttpError(403, \"Connection is disabled.\", \"local_stdio_connection_disabled\", {\n        connectionId: connection.id,\n      });\n    }\n    return { entry, connection };\n  }","sourceCodeStart":3463,"sourceCodeEnd":3499,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L3463-L3499","documentation":"getGatewayWithTokens found no toolMcpGateways row for the given gatewayId within the company. The 404 fires on the company-scoped lookup, so it also covers cross-company access attempts; the gateway was deleted or the id is wrong.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:3340 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the MCP gateway ID exists for this company; list gateways and use a valid one."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}