n8n - 💡(How to fix) Fix OpenAI credential type fails

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Describe the problem/error/question

The OpenAI credential type fails with the same error in three places on n8n Cloud (verified on stable 2.21.0 and the latest beta): 3. HTTP Request nodes using Authentication = Predefined Credential Type → OpenAI throw the error before dispatching any HTTP call. The error wording points to an Axios version mismatch — config.headers.setContentType() is a method on AxiosHeaders instances in Axios 1.x. If the credential path passes a plain object where AxiosHeaders is expected, this is exactly the error you'd see.

What is the error message (if any)?

  1. OpenAI credential editor showing the "Couldn't connect" banner with the setContentType error.
  2. An HTTP Request node (Predefined Credential Type → OpenAI) showing the same error in its execution output.
  • error: all

Fix Action

Fix / Workaround

  1. Credential editor "Save" returns "Couldn't connect with these settings."
  2. The @n8n/n8n-nodes-langchain.openAi node's Model "From list" dropdown returns "Could not load list."
  3. HTTP Request nodes using Authentication = Predefined Credential Type → OpenAI throw the error before dispatching any HTTP call.

Workaround: replace the OpenAI credential with a Header Auth credential and switch HTTP Request nodes to Generic Credential Type → Header Auth. This unblocks HTTP Request nodes but not @n8n/n8n-nodes-langchain.openAi, which can only consume an OpenAI-typed credential.

environment

  • Reproduced on stable 2.21.0 and latest beta as of [date you tested beta].
  • Affects: OpenAI credential test, @n8n/n8n-nodes-langchain.openAi Model picker, HTTP Request nodes with Predefined Credential Type → OpenAI.
  • Header Auth workaround unblocks HTTP Request nodes only — the LangChain OpenAI node has no equivalent workaround short of rebuilding it as raw HTTP Request.
RAW_BUFFERClick to expand / collapse

Describe the problem/error/question

The OpenAI credential type fails with the same error in three places on n8n Cloud (verified on stable 2.21.0 and the latest beta):

  1. Credential editor "Save" returns "Couldn't connect with these settings."
  2. The @n8n/n8n-nodes-langchain.openAi node's Model "From list" dropdown returns "Could not load list."
  3. HTTP Request nodes using Authentication = Predefined Credential Type → OpenAI throw the error before dispatching any HTTP call.

The API key is valid: the same key works in <500ms when used via a Header Auth credential (Name=Authorization, Value=Bearer sk-...) on the same endpoint. So the problem is in the OpenAI credential injection path, not the key, the network, or OpenAI itself.

The error wording points to an Axios version mismatch — config.headers.setContentType() is a method on AxiosHeaders instances in Axios 1.x. If the credential path passes a plain object where AxiosHeaders is expected, this is exactly the error you'd see.

Updating to the latest beta did not fix it.

Workaround: replace the OpenAI credential with a Header Auth credential and switch HTTP Request nodes to Generic Credential Type → Header Auth. This unblocks HTTP Request nodes but not @n8n/n8n-nodes-langchain.openAi, which can only consume an OpenAI-typed credential.

What is the error message (if any)?

config.headers.setContentType is not a function

Identical wording in all three failure surfaces. No stack trace, no HTTP status, no response body.

Please share your workflow/screenshots/recording

[paste your workflow JSON here — remove the API key first]

Attach screenshots of:

  1. OpenAI credential editor showing the "Couldn't connect" banner with the setContentType error.
  2. The LangChain OpenAI node Model dropdown showing "Could not load list."
  3. An HTTP Request node (Predefined Credential Type → OpenAI) showing the same error in its execution output.

Share the output returned by the last node

config.headers.setContentType is not a function

No HTTP request reaches OpenAI. Same node with Authentication switched to Generic Credential Type → Header Auth (same API key, wrapped as "Bearer sk-...") returns 200 OK with the expected JSON in <500ms.

Steps to reproduce

A. Credential test

  1. Create a new OpenAI credential with a valid key.
  2. Click Save.
  3. See: "Couldn't connect with these settings — config.headers.setContentType is not a function."

B. LangChain OpenAI Model dropdown

  1. Add @n8n/n8n-nodes-langchain.openAi, Resource=Text, Operation=Message a Model.
  2. Assign the OpenAI credential.
  3. Open the Model "From list" dropdown.
  4. See: "Could not load list — config.headers.setContentType is not a function."

C. HTTP Request via Predefined Credential

  1. HTTP Request node: GET https://api.openai.com/v1/models.
  2. Authentication = Predefined Credential Type → OpenAI → your OpenAI credential.
  3. Execute.
  4. See: "config.headers.setContentType is not a function" — no HTTP call made.

Negative control:

  1. Create a Header Auth credential: Name=Authorization, Value=Bearer <same key>.
  2. Same HTTP Request node, Authentication = Generic Credential Type → Header Auth → that credential.
  3. Execute.
  4. Returns 200 OK with expected payload.

Debug info

core

  • n8nVersion: 2.21.0
  • platform: docker (cloud)
  • nodeJsVersion: 24.14.1
  • nodeEnv: production
  • database: sqlite
  • executionMode: regular
  • concurrency: 5
  • license: enterprise (sandbox)

environment

  • Reproduced on stable 2.21.0 and latest beta as of [date you tested beta].
  • Affects: OpenAI credential test, @n8n/n8n-nodes-langchain.openAi Model picker, HTTP Request nodes with Predefined Credential Type → OpenAI.
  • Header Auth workaround unblocks HTTP Request nodes only — the LangChain OpenAI node has no equivalent workaround short of rebuilding it as raw HTTP Request.

What we need

  1. Confirmation the bug is reproducible and which n8n release contains the fix.
  2. ETA for the fix on n8n Cloud.
  3. Any temporary workaround for @n8n/n8n-nodes-langchain.openAi specifically. Debug info core

n8nVersion: 2.21.0 platform: docker (cloud) nodeJsVersion: 24.14.1 nodeEnv: production database: sqlite executionMode: regular concurrency: 5 license: enterprise (sandbox)

storage [leave blank unless n8n support specifically asks for storage config] environment notes

Reproduced on stable 2.21.0 and on the latest beta channel as of [insert the date you tested the beta]. Affects: OpenAI credential test path; @n8n/n8n-nodes-langchain.openAi model picker; HTTP Request nodes using Predefined Credential Type → OpenAI. The Header Auth workaround unblocks 3 of the 4 OpenAI-dependent nodes in our workflow; the 4th (@n8n/n8n-nodes-langchain.openAi) requires an OpenAI-typed credential, so we cannot fully work around the issue without rebuilding that step as a raw HTTP Request.

What we need

Confirmation the bug is reproducible on your side, and which n8n release contains (or will contain) the fix. ETA for the fix to land on n8n Cloud. Whether there's a known temporary workaround for the LangChain OpenAI node specifically — it cannot consume a Header Auth credential, and rebuilding it as raw HTTP Request loses the node's structured Messages UI.

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 168 hours
  • maxCount: 2500 executions

client

  • userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/147.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2026-05-12T16:47:28.865Z

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING