OpenAI Node - "Message a Model" (v2 Actions) - 錯誤請求 - 請檢查您的參數

描述問題/錯誤/問題

在使用新的 v2 Actions 佈局時,最新版本的原生 OpenAI 節點 (2.3 (最新)) 中似乎存在迴歸 @Bug。具體來說,當選擇 Resource: Text → Operation: Message a Model 並將 Output Format 配置為 JSON Schema 或 JSON Object 時,節點在執行時會完全失敗。
後台 API 呼叫會因 OpenAI 的 400 Bad Request 錯誤而崩潰。

錯誤訊息:

Invalid value: ‘input_text’. Supported values are: ‘output_text’ and ‘refusal’.

OpenAI 的 API 指南規定,它在有效負載物件陣列的此層級嚴格期望 output_text 或 refusal。

我們為測試和隔離問題所做的工作:

  1. 測試 Output Format 切換: 我們嘗試從 JSON Schema (recommended) 切換到基本 JSON Object 以移除嚴格的架構強制執行。錯誤仍然發生,表明 n8n 的背景工具呼叫/聊天包裝層正在硬編碼或強制 input_text 參數,不管選擇的格式如何。

  2. 測試訊息角色解決方法: 我們嘗試將使用者輸入和系統規則組合到單個 System 訊息塊中,以防止 n8n 建立巢狀的 User 角色陣列參數。該節點仍然強制了無效的有效負載配置。

  3. 透過 HTTP Request Node 驗證: 為了證明問題是 n8n 節點格式化錯誤而不是 OpenAI API 停機或不良提示設計,我們使用標準 HTTP Request Node 手動編寫了針對 https://api.openai.com/v1/chat/completions 的請求,使用完全相同的有效負載。它執行並完美解析了 JSON。

有效的解決方案 / 解決方法:

作為確定性測試,我們從舊版工作流中複製了較舊版本的 OpenAI 整合 (Node Version 1.4) 到畫布中。使用具有相同提示、參數和輸入資料的舊版 1.4 節點結構,工作流執行完美無缺。 這指向 Node Version 2.3 在如何為 OpenAI 的較新 Responses API 端點處理有效負載渲染中存在的錯誤。

錯誤訊息是什麼(如果有的話)?

Invalid value: ‘input_text’. Supported values are: ‘output_text’ and ‘refusal’.

請分享您的工作流

(在您的畫布上選擇節點,並使用鍵盤快速鍵 CMD+C/CTRL+C 和 CMD+V/CTRL+V 來複製和貼上工作流。)

分享最後一個節點傳回的輸出

{
“errorMessage”: “Bad request - please check your parameters”,
“errorDescription”: “Invalid value: ‘input_text’. Supported values are: ‘output_text’ and ‘refusal’.”,
“errorDetails”: {
“rawErrorMessage”: [
“400 - {"error":{"message":"Invalid value: ‘input_text’. Supported values are: ‘output_text’ and ‘refusal’.","type":"invalid_request_error","param":"input[2].content[0]","code":"invalid_value"}}”
],
“httpCode”: “400”
},
“n8nDetails”: {
“nodeName”: “Create post and image”,
“nodeType”: “@n8n/n8n-nodes-langchain.openAi”,
“nodeVersion”: 2.3,
“resource”: “text”,
“operation”: “response”,
“itemIndex”: 0,
“time”: “17/06/2026, 1:41:31 pm”,
“n8nVersion”: “2.23.4 (Self Hosted)”,
“binaryDataMode”: “filesystem”,
“stackTrace”: [
“NodeApiError: Bad request - please check your parameters”,
" at ExecuteContext.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_09b6de71aa48ba17834bf7615757388b/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1368:10)“,
" at processTicksAndRejections (node:internal/process/task_queues:104:5)”,
" at ExecuteContext.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_09b6de71aa48ba17834bf7615757388b/node_modules/n8n-core/src/execution-engine/node-execution-context/utils/request-helper-functions.ts:1711:11)“,
" at ExecuteContext.apiRequest (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+n8n-nodes-langchain@file+packages+@n8n+nodes-langchain_6aac9327acd297c90db6397ea0a88739/node_modules/@n8n/n8n-nodes-langchain/nodes/vendors/OpenAi/transport/index.ts:56:19)”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+n8n-nodes-langchain@file+packages+@n8n+nodes-langchain_6aac9327acd297c90db6397ea0a88739/node_modules/@n8n/n8n-nodes-langchain/nodes/vendors/OpenAi/v2/actions/text/response.operation.ts:621:18)“,
" at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+n8n-nodes-langchain@file+packages+@n8n+nodes-langchain_6aac9327acd297c90db6397ea0a88739/node_modules/@n8n/n8n-nodes-langchain/nodes/vendors/OpenAi/v2/actions/router.ts:58:25)”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+n8n-nodes-langchain@file+packages+@n8n+nodes-langchain_6aac9327acd297c90db6397ea0a88739/node_modules/@n8n/n8n-nodes-langchain/nodes/vendors/OpenAi/v2/OpenAiV2.node.ts:93:10)“,
" at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_09b6de71aa48ba17834bf7615757388b/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1053:9)”,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_09b6de71aa48ba17834bf7615757388b/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1327:11)“,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_09b6de71aa48ba17834bf7615757388b/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1778:27”,
" at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+exporter-trace-otlp_09b6de71aa48ba17834bf7615757388b/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2426:11"
]
}
}

關於您的 n8n 設定的資訊

  • n8n 版本: 2.23.4 (Self Hosted)
  • 資料庫 (預設: SQLite):
  • n8n EXECUTIONS_PROCESS 設定 (預設: own, main):
  • 執行 n8n 的方式 (Docker、npm、n8n cloud、desktop app): Docker - Self-hosted
  • 作業系統:

@bridgewaretech 很好的隔離。根本原因是 Responses API 內容類型:assistant 角色的訊息必須使用 output_text,只有 user/developer 才使用 input_text。您的 input[2] 是一個 assistant 訊息(之前的回合或附加的聊天記憶子節點),v2.3 將其標記為 input_text,因此出現 400 錯誤。

有用的提示:只有當 assistant 訊息在輸入中時才會觸發,所以從該節點中移除記憶/歷史子節點可以規避它(如果您需要上下文則不可行,但這確認了觸發因素)。v1.4 通過改為呼叫 chat/completions 來規避它,所以那個和您的 HTTP 解決方案是正確的臨時解決方案。

已知的 v2 節點迴歸,如果 n8n-io/n8n GitHub 上還沒有開啟問題,值得添加您的清晰重現步驟。

謝謝 @achamm
我們已經把這個問題新增到 GitHub 了。

@bridgewaretech 不客氣!歡迎標記其中一個回覆為解決方案,祝你有美好的一天!希望這能得到修復!你也能提供一下問題連結嗎?

:police_car_light: 開發者更新 / GitHub 狀態

關於此主題的快速更新。我們已直接在 GitHub 上向開發者反映此錯誤,他們已確認該問題。[Github 連結在此]

以下是開發者的備註/更新:

根本原因: v2「向模型發送消息」操作無論角色如何都會使用 input_text 內容部分建構每個文本消息。OpenAI 的 Responses API 僅接受助手角色消息的 output_text/refusal,因此一旦列表中有助手消息,請求就會失敗並顯示:

Invalid value: ‘input_text’. Supported values are: ‘output_text’ and ‘refusal’.

輸出格式 (JSON Schema / JSON Object) 實際上並不是觸發因素 — 而是以 input_text 形式發送的助手角色消息。舊版 1.4 節點能正常運作,因為它針對的是較舊的 chat/completions 端點,該端點不使用這些類型化的內容部分。

修復: 助手文本消息將作為純字符串內容發送(Responses API 接受並將其視為助手輸出文本),而不是 input_text 部分;用戶/系統消息保持不變。包含此變更和回歸測試的 PR 即將推出,將在此連結。

在修復發佈前的解決方案:

  • 移除助手角色消息並將該上下文折疊到系統消息中,或
  • 繼續使用您已驗證可行的 HTTP Request 節點(或 1.4 節點)。

:police_car_light: 開發者更新 / GitHub 狀態

根據開發更新,修復已隨 n8n@2.29.0 發佈