{"record":{"id":"a9593674469a65cb","repo":"paperclipai/paperclip","slug":"message","errorCode":null,"errorMessage":"message","messagePattern":"message","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":422,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":6204,"sourceCode":"        .where(and(eq(toolMcpGateways.companyId, input.companyId), eq(toolMcpGateways.id, input.gatewayId)))\n        .limit(1);\n      if (!existing) throw new ToolGatewayHttpError(404, \"MCP gateway not found\", \"gateway_not_found\");\n      await assertGatewayContext({\n        companyId: input.companyId,\n        profileId: input.body.profileId ?? existing.profileId,\n        agentId: input.body.agentId === undefined ? existing.agentId : input.body.agentId,\n        projectId: input.body.projectId === undefined ? existing.projectId : input.body.projectId,\n        issueId: input.body.issueId === undefined ? existing.issueId : input.body.issueId,\n      });\n      const [updated] = await db\n        .update(toolMcpGateways)\n        .set({\n          ...(input.body.name !== undefined ? { name: input.body.name } : {}),\n          ...(input.body.slug !== undefined || input.body.displaySlug !== undefined ? { slug: input.body.displaySlug ?? input.body.slug } : {}),\n          ...(input.body.slug !== undefined || input.body.displaySlug !== undefined ? { displaySlug: input.body.displaySlug ?? input.body.slug } : {}),\n          ...(input.body.description !== undefined ? { description: input.body.description ?? null } : {}),\n          ...(input.body.status !== undefined ? { status: input.body.status } : {}),\n          ...(input.body.profileId !== undefined ? { profileId: input.body.profileId } : {}),\n          ...(input.body.defaultProfileMode !== undefined ? { defaultProfileMode: input.body.defaultProfileMode } : {}),\n          ...(input.body.contextScopeType !== undefined ? { contextScopeType: input.body.contextScopeType } : {}),\n          ...(input.body.contextScopeId !== undefined ? { contextScopeId: input.body.contextScopeId ?? null } : {}),\n          ...(input.body.agentId !== undefined ? { agentId: input.body.agentId ?? null } : {}),\n          ...(input.body.projectId !== undefined ? { projectId: input.body.projectId ?? null } : {}),\n          ...(input.body.issueId !== undefined ? { issueId: input.body.issueId ?? null } : {}),\n          ...(input.body.approvalIssueId !== undefined ? { approvalIssueId: input.body.approvalIssueId ?? null } : {}),\n          ...(input.body.authConfig !== undefined ? { authConfig: input.body.authConfig } : {}),\n          ...(input.body.headerPolicy !== undefined ? { headerPolicy: input.body.headerPolicy } : {}),\n          ...(input.body.metadataPolicy !== undefined ? { metadataPolicy: input.body.metadataPolicy } : {}),\n          ...(input.body.onDemandToolsConfig !== undefined ? { onDemandToolsConfig: input.body.onDemandToolsConfig } : {}),\n          ...(input.body.metadata !== undefined ? { metadata: input.body.metadata ?? {} } : {}),\n          updatedAt: new Date(),\n        })\n        .where(and(eq(toolMcpGateways.companyId, input.companyId), eq(toolMcpGateways.id, input.gatewayId)))\n        .returning();\n      if (input.body.profileId && input.body.profileId !== existing.profileId) {\n        await db","sourceCodeStart":6186,"sourceCodeEnd":6222,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L6186-L6222","documentation":"Not a literal throw message: this is the audit details block for tool_gateway.call_failed / call_deferred. The referenced field is the normalized error 'message' variable — the upstream/tool error text captured after a failed or deferred tool call, recorded with invocationId, reasonCode, durationMs, and execution audit metadata for diagnosis.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:6017 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The tool call failed with the wrapped error message; address the reported cause (often a validation or provider error) and retry."],"exampleFix":null,"handlingStrategy":"try-catch","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"}