{"record":{"id":"41639792ae6c2921","repo":"n8n-io/n8n","slug":"assistant-sdk-returned-http-string-response-stat","errorCode":null,"errorMessage":"Assistant SDK returned HTTP ${String(response.status)}","messagePattern":"Assistant SDK returned HTTP (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-workflow-builder.ee/src/assistant/assistant-handler.ts","lineNumber":150,"sourceCode":"\t\t\t\t\tdisplayName: context.credentialContext.displayName,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn { payload: initPayload };\n\t}\n\n\t/**\n\t * Call the SDK and validate the response.\n\t */\n\tprivate async callSdk(\n\t\tpayload: { payload: object; sessionId?: string },\n\t\tuserId: string,\n\t): Promise<Response> {\n\t\tconst response = await this.client.chat(payload, { id: userId });\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Assistant SDK returned HTTP ${String(response.status)}`);\n\t\t}\n\n\t\treturn response;\n\t}\n\n\t/**\n\t * Consume the SDK's streaming response, mapping messages and writing chunks.\n\t * Follows the same approach as the frontend streamRequest() utility.\n\t */\n\tprivate async consumeSdkStream(\n\t\tresponse: Response,\n\t\twriter: StreamWriter,\n\t\tsignal?: AbortSignal,\n\t\ttoolCallId?: string,\n\t\tcontext?: AssistantContext,\n\t): Promise<AssistantResult> {\n\t\tconst body = response.body;\n\t\tif (!body) {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-workflow-builder.ee/src/assistant/assistant-handler.ts#L132-L168","documentation":"HTTP-failure error in assistant-handler's callSdk. It fires when the Assistant SDK chat response has a non-ok status; the numeric status is surfaced so callers can distinguish auth (401/403), rate limiting (429), and server errors (5xx). Raised before any streaming starts.","triggerScenarios":"Thrown at packages/@n8n/ai-workflow-builder.ee/src/assistant/assistant-handler.ts:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the AI Assistant/gateway service status; a non-2xx from the SDK means the upstream call failed.","Verify authentication/configuration of the assistant client (credentials, project ids sent in the payload).","Use the HTTP status in the message to distinguish auth (401/403), rate limit (429), and server (5xx) problems."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","contentChangedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}