NocoDB Unable to Update Row with Binary Data

Having a very strange issue when trying to upload a binary file (jpeg) to nocodb via the update row function with field type set to binary after generating with gpt-image-1 API and converting from b_64json to binary

Error Message

Bad request - please check your parameters

Expected closing tag 'meta' (opened in line 4, col 1) instead of closing tag 'head'.:6:1 Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.

Please share your workflow

Share the output returned by the last node

Expecting upload to nocodb cell (which type is already attachment)

Information on your n8n setup

  • n8n version: 1.90.2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker Compose
  • Operating system: Ubuntu Linux

The error message “Expected closing tag ‘meta’ (opened in line 4, col 1) instead of closing tag ‘head’” indicates that NocoDB is trying to interpret the binary data of your JPEG image as HTML. This means you’re likely sending the data incorrectly formatted to the update row function. NocoDB expects binary data, not HTML or improperly encoded data.

Here’s a breakdown of the likely problem and how to fix it in your n8n workflow:

  1. Incorrect Data Encoding/Formatting: The core issue is that the binary JPEG data is being misinterpreted. The conversion from base64 JSON to binary might be flawed, or you might be unintentionally adding HTML tags or metadata somewhere in the process.

  2. NocoDB update row Configuration: Ensure your NocoDB column is genuinely set to “Binary” type. Double-check the field configuration in your NocoDB table.

  3. n8n Workflow Steps:

  • GPT Image Generation: Verify that the GPT image generation node is outputting a valid base64 encoded image. Most image generation APIs will provide this format directly.

  • Base64 to Binary Conversion: This is the most likely source of the error. You need to ensure you’re correctly decoding the base64 string into binary data without introducing any extra characters or formatting.

Here’s how to do it correctly in n8n:

* **Using the 'Binary Data' node:** The simplest and most reliable method.

  1. Add a 'Binary Data' node after your GPT image generation node.

  2. Set 'Operation' to 'Decode from Base64'.

  3. Connect the base64 output of the GPT node to the input of the 'Binary Data' node. This will correctly decode the image data.
* **Using an 'Expression' node (less recommended):** If you must use an expression, make absolutely certain you're only decoding the base64, without any string manipulation that could add unwanted characters. For example, in JavaScript:
Buffer.from(item.json.base64String, 'base64')

content_copydownload

Use code with caution.JavaScript

  • NocoDB Node Configuration: In your NocoDB update row node:

    • Binary Data Input: Connect the output of the ‘Binary Data’ node (or the correctly formatted binary output from the ‘Expression’ node) to the appropriate field in the update row node.

    • Headers (Important!): Make sure you are not setting the Content-Type header to text/html or anything similar. NocoDB should infer the correct content type from the binary data itself. If you have a Content-Type header, remove it or set it explicitly to application/octet-stream for raw binary data.

  1. Debugging:
  • Inspect Data in n8n: Use the ‘Execute Workflow’ button and examine the output of each node, especially after the base64 decoding and before the NocoDB node. Make sure the data is binary and doesn’t contain any stray HTML tags.

  • NocoDB API Logs (if accessible): Check NocoDB’s logs for more detailed error information.

By meticulously checking each step and ensuring the proper conversion of base64 to binary and correct configuration of the NocoDB node, you should resolve this error. The use of the ‘Binary Data’ node is highly recommended to avoid common encoding pitfalls.