{"record":{"id":"405a34a5e2d5db12","repo":"paperclipai/paperclip","slug":"mcp-remote-status","errorCode":"mcp_remote_status","errorMessage":"Remote MCP server returned an HTTP error","messagePattern":"Remote MCP server returned an HTTP error","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":502,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":3106,"sourceCode":"      payload,\n    });\n  }\n\n  async function createStandingDelegationInteraction(\n    session: ToolGatewaySession,\n    connection: typeof toolConnections.$inferSelect,\n    userId: string,\n  ) {\n    if (!session.issueId || !session.agentId || !session.runId) return;\n    const [company] = await db.select({ issuePrefix: companies.issuePrefix }).from(companies)\n      .where(eq(companies.id, session.companyId)).limit(1);\n    const href = `/${company?.issuePrefix ?? \"\"}/apps/${connection.id}/setup`;\n    const idempotencyKey = `connection-delegation:${connection.id}:${userId}:${session.agentId}`;\n    const payload = {\n      version: 1 as const,\n      prompt: `Allow this agent to use your ${connection.name} account for autonomous runs`,\n      acceptLabel: \"Review delegation\",\n      rejectLabel: \"Not now\",\n      detailsMarkdown: \"This autonomous run is paused. Paperclip will not use your personal identity until you explicitly delegate it to this named agent.\",\n      target: {\n        type: \"custom\" as const,\n        key: `connection:${connection.uid}:delegation:${userId}:${session.agentId}`,\n        revisionId: connection.updatedAt.toISOString(),\n        label: `Delegate ${connection.name}`,\n        href,\n      },\n    };\n    const [existing] = await db.select({ id: issueThreadInteractions.id }).from(issueThreadInteractions).where(and(\n      eq(issueThreadInteractions.companyId, session.companyId),\n      eq(issueThreadInteractions.issueId, session.issueId),\n      eq(issueThreadInteractions.idempotencyKey, idempotencyKey),\n    )).limit(1);\n    if (existing) {\n      await db.update(issueThreadInteractions).set({\n        status: \"pending\",\n        continuationPolicy: \"wake_assignee\",","sourceCodeStart":3088,"sourceCodeEnd":3124,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/server/src/services/tool-gateway.ts#L3088-L3124","documentation":"Remote MCP forwarding: the upstream server answered tools/call with a non-2xx HTTP status. The connection health is marked error and a 502 mcp_remote_status wraps the upstream status, request id, and execution details — the failure originates in the remote server, not the gateway or the agent's request shape.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:3106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The remote MCP server returned an HTTP error. Check the server URL, credentials, and remote server health, then retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5716fe907e596ce73501408fc6efdb19fb61edf2","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}