Open AI Chat Node Error [Invalid value for 'content': expected a string, got null.]

Describe the problem/error/question

I’m passing a prompt through with the field ‘chatInput’ but getting the error “Invalid value for ‘content’: expected a string, got null.”. I’ve stringified it and it still doesn’t work. It seems like a problem with the API but not sure.

What is the error message (if any)?

{
  "errorMessage": "Bad request - please check your parameters",
  "errorDescription": "Invalid value for 'content': expected a string, got null.",
  "errorDetails": {
    "rawErrorMessage": [
      "400 - {\"error\":{\"message\":\"Invalid value for 'content': expected a string, got null.\",\"type\":\"invalid_request_error\",\"param\":\"messages.[9].content\",\"code\":null}}"
    ],
    "httpCode": "400"
  },
  "n8nDetails": {
    "nodeName": "OpenAI1",
    "nodeType": "@n8n/n8n-nodes-langchain.openAi",
    "nodeVersion": 1.4,
    "resource": "text",
    "operation": "message",
    "itemIndex": 0,
    "time": "7/24/2024, 9:53:37 AM",
    "n8nVersion": "1.52.0 (Cloud)",
    "binaryDataMode": "filesystem",
    "stackTrace": [
      "NodeApiError: Bad request - please check your parameters",
      "    at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1293:19)",
      "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
      "    at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:2083:20)",
      "    at Object.apiRequest (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/dist/nodes/vendors/OpenAi/transport/index.js:17:12)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/dist/nodes/vendors/OpenAi/actions/text/message.operation.js:240:21)",
      "    at Object.router (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/dist/nodes/vendors/OpenAi/actions/router.js:64:34)",
      "    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/dist/nodes/vendors/OpenAi/OpenAi.node.js:16:16)",
      "    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:673:51",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1085:20"
    ]
  }
}

Please share your workflow

Share the output returned by the last node

  {
    "chatInput": "Summarize my latest email from stephanie walker"
  }

Information on your n8n setup

  • n8n version:

1.52.0

  • Database (default: SQLite):

Pinecone

  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):

Cloud

  • Operating system:

It looks like an issue with the Vector Store tool. It outputs ‘response’ and the node is expecting ‘content’. However, it’s been working just fine in the past, even just yesterday.

1 Like

Hey @Devin_Kearns,

Welcome to the community :cake:

It should still be ok, What happens if you disable the json option in the OpenAI node does that make any difference? Did anything change between it working and it not working?

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