{"record":{"id":"de0b002fd70d76fe","repo":"n8n-io/n8n","slug":"failed-to-upload-capabilities-response-status","errorCode":null,"errorMessage":"Failed to upload capabilities: ${response.status} ${text}","messagePattern":"Failed to upload capabilities: (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/computer-use/src/gateway-client.ts","lineNumber":318,"sourceCode":"\t\theaders.set('Content-Type', 'application/json');\n\t\theaders.set('X-Gateway-Key', this.apiKey);\n\t\tconst response = await fetch(url, {\n\t\t\tmethod: 'POST',\n\t\t\theaders,\n\t\t\tbody: JSON.stringify({\n\t\t\t\trootPath: this.dir,\n\t\t\t\ttools,\n\t\t\t\thostIdentifier: `${os.userInfo().username}@${os.hostname()}`,\n\t\t\t\ttoolCategories: this.activeToolCategories,\n\t\t\t}),\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst text = await response.text();\n\t\t\tif (response.status === 401 || response.status === 403) {\n\t\t\t\tthrow new GatewayAuthError(response.status, text);\n\t\t\t}\n\t\t\tthrow new Error(`Failed to upload capabilities: ${response.status} ${text}`);\n\t\t}\n\n\t\t// If the server returned a session key, switch to it for all subsequent requests\n\t\t// n8n wraps controller responses in { data: ... }\n\t\tconst body = (await response.json()) as { data: { ok: boolean; sessionKey?: string } };\n\t\tif (body.data.sessionKey) {\n\t\t\tthis.sessionKey = body.data.sessionKey;\n\t\t\tlogger.debug('Pairing token consumed, switched to session key');\n\t\t}\n\n\t\tlogger.debug('Capabilities uploaded', { toolCount: tools.length });\n\t}\n\n\tprivate connectSSE(): void {\n\t\tconst url = `${this.options.url}/rest/instance-ai/gateway/events`;\n\n\t\tlogger.debug('Connecting to gateway', { keyPrefix: this.apiKey.slice(0, 8) });\n\t\tconst apiKey = this.apiKey;","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/computer-use/src/gateway-client.ts#L300-L336","documentation":"Thrown by uploadCapabilities() when the gateway init endpoint returns a non-OK status that is NOT 401/403 (those throw GatewayAuthError separately). Covers 4xx client errors and 5xx server errors from the /rest/instance-ai/gateway/init endpoint during tool capability registration.","triggerScenarios":"Gateway returns 400 (malformed tool payload or schema serialization failure), 409 (session already initialized), 500 (n8n internal error), 502/503 (gateway unavailable or overloaded).","commonSituations":"Tool definition with an inputSchema that fails zodToJsonSchema serialization, n8n server bug, gateway under heavy load, version mismatch between computer-use client and server API.","solutions":["Check the response status and text in the error message for the specific failure","For 5xx: retry with backoff or check n8n server health and logs","For 4xx: verify tool definitions produce valid JSON schemas","Ensure the computer-use package version is compatible with the n8n server version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"function isUploadCapabilitiesError(e: unknown): boolean {\n  return e instanceof Error && e.message.startsWith('Failed to upload capabilities:');\n}","tryCatchPattern":"const MAX_RETRIES = 3;\nfor (let attempt = 0; attempt < MAX_RETRIES; attempt++) {\n  try {\n    await gatewayClient.start();\n    break;\n  } catch (e) {\n    const status = e instanceof Error ? parseInt(e.message.match(/\\d{3}/)?.[0] ?? '0') : 0;\n    if (status >= 500 && attempt < MAX_RETRIES - 1) {\n      await new Promise(r => setTimeout(r, 2000 * (attempt + 1)));\n      continue;\n    }\n    throw e;\n  }\n}","preventionTips":["Ensure tool definitions produce valid JSON schemas via zodToJsonSchema","Verify computer-use package version compatibility with the n8n server","Retry 5xx failures with exponential backoff; investigate 4xx as configuration issues"],"tags":["gateway","http","computer-use"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}