N8N giving error when calling Stable Diffusion API

Describe the problem/error/question

I am trying to call the stable diffusion API.

What is the error message (if any)?

ERROR: Bad request - please check your parameters
{"status":"rejected","reason":{"message":"400 - \"{\\\"id\\\":\\\"86b15e3151a661cc01ecab78af8cac71\\\",\\\"message\\\":\\\"accept header can only be application/json or image/png\\\",\\\"name\\\":\\\"bad_request\\\"}\\n\"","name":"Error","stack":"Error: 400 - \"{\\\"id\\\":\\\"86b15e3151a661cc01ecab78af8cac71\\\",\\\"message\\\":\\\"accept header can only be application/json or image/png\\\",\\\"name\\\":\\\"bad_request\\\"}\\n\"\n    at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at RedirectableRequest.handleResponse (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:238:9)\n    at RedirectableRequest.emit (node:events:525:35)\n    at RedirectableRequest.emit (node:domain:552:15)\n    at RedirectableRequest._processResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:356:10)\n    at ClientRequest.RedirectableRequest._onNativeResponse (/usr/local/lib/node_modules/n8n/node_modules/follow-redirects/index.js:62:10)\n    at Object.onceWrapper (node:events:628:26)\n    at ClientRequest.emit (node:events:525:35)\n    at ClientRequest.emit (node:domain:552:15)\n    at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)\n    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)\n    at TLSSocket.socketOnData (node:_http_client:534:22)\n    at TLSSocket.emit (node:events:513:28)\n    at TLSSocket.emit (node:domain:552:15)\n    at addChunk (node:internal/streams/readable:315:12)\n    at readableAddChunk (node:internal/streams/readable:289:9)\n    at TLSSocket.Readable.push (node:internal/streams/readable:228:10)\n    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)\n    at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17)"}}

Please share your workflow

Share the output returned by the last node

Only the error above

Information on your n8n setup

Hi @skoopadmin, I am sorry you are having trouble.

It seems the service doesn’t like the default n8n accept header.

Can you try changing your header name to all lowercase like below?

image

This should lead to n8n only using your custom accept header (with an uppercase value of Accept n8n would attach its default values).

Meaning with an uppercase Accept these headers would be sent to your API:

With a lowercase accept it would be these headers instead:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.