# Code node suddenly throwing unknown error

**URL:** <https://community.n8n.io/t/code-node-suddenly-throwing-unknown-error/294554>\
**Category:** Questions\
**Tags:** object-object\
**Created:** [May 5, 2026, 3:58pm UTC](https://community.n8n.io/t/code-node-suddenly-throwing-unknown-error/294554 "2026-05-05T15:58:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flowdan](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@flowdan](https://community.n8n.io/u/flowdan)\
**Post date:** [May 5, 2026, 3:58pm UTC](https://community.n8n.io/t/code-node-suddenly-throwing-unknown-error/294554/1 "2026-05-05T15:58:23Z")

</div>

## Describe the problem/error/question

I’ve been working on a workflow for awhile, but haven’t touched it in almost 2 weeks now (last touch would have been ~20th of April). In that time I believe our instance was updated from 2.18.4 → 2.18.7 (set to auto-update), however I see nothing in the release notes that should cause this issue. I’ve since updated to 2.19.2 (auto-update didn’t do this one, had to do it manually) and am still seeing the same results. I’ll revert if I have to, but if some functionality has been purposefully changed/removed, I’ll need to fix this if I ever want to upgrade anyways…

```auto
The initial steps of the workflow are
-isolate a single pdf attachment from an email
-generate a prompt for Claude to process said PDF (code node, js)
-Submits to Claude (http)
The code that had been working to generate the prompt is this:

```

```auto
const binaryData = $input.item.binary.attachment_0;
const buffer = await this.helpers.getBinaryDataBuffer(0, 'attachment_0');
const base64Pdf = buffer.toString('base64');
const body = {
  model: 'claude-sonnet-4-6',
  max_tokens: 2000,
  messages: [
    {
      role: 'user',
      content: [
        {
          type: 'document',
          source: {
            type: 'base64',
            media_type: 'application/pdf',
            data: base64Pdf
          }
        },
        {
          type: 'text',
          text: 'Extract the following data from this PDF: -Purchase order number -Ship Date -Invoice number -Array of items ordered. Include the dell part number (do not include the word Dell), description, serial number, and ext net price. Return ONLY the raw JSON with no markdown, no explanation, no code fences.'
        }
      ]
    }
  ]
};
return [{
  json: { body: JSON.stringify(body) }
}];

```

Resulting in:

![image](https://europe1.discourse-cdn.com/n8n/original/3X/6/3/63bb2c03f6b643b8940bbf6cd8de1f7564dd20b2.png)

The initial step to isolate the PDF uses this code:

```auto

const binary = $input.item.binary;
// Find the key of the PDF attachment
const pdfKey = Object.keys(binary).find(
  key => binary[key].mimeType === 'application/pdf'
);
if (!pdfKey) {
  throw new Error('No PDF attachment found on this email');
}
return [{
  json: $input.item.json, // pass through the email data unchanged
  binary: {
    attachment_0: binary[pdfKey] // rename it to a predictable key
  }
}];

```

Resulting in attachment\_0

However after returning to this workflow after ~2 weeks, that gen prompt step now results in an unknown error. I’ve tried fixing it with various other js code, with no luck recreating what I need. My familiarity with JS is amateur-level, but Claude has been great at generating code. I’ve gone through several iterations with no luck.

## 

## Information on your n8n setup

- **n8n version: 2.18.7 - 2.19.2 (self-hosted)**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app): docker**
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![flowdan](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@flowdan](https://community.n8n.io/u/flowdan)\
**Post date:** [May 6, 2026, 4:07pm UTC](https://community.n8n.io/t/code-node-suddenly-throwing-unknown-error/294554/3 "2026-05-06T16:07:28Z")

</div>

Disregard… I rebooted my n8n server and it appears to be working again. One of the updates must have locked it out from something.

---

<div class="post-metadata">

**Author:** ![tamy.santos](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/tamy.santos/32/153776_2.png) [@tamy.santos](https://community.n8n.io/u/tamy.santos)\
**Post date:** [May 8, 2026, 6:16pm UTC](https://community.n8n.io/t/code-node-suddenly-throwing-unknown-error/294554/4 "2026-05-08T18:16:23Z")

</div>

great @flowdan , the important thing is that it’s working now.  
I recommend marking your reply as the solution so it can help other people in the community when they search for something similar later.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [May 15, 2026, 6:17pm UTC](https://community.n8n.io/t/code-node-suddenly-throwing-unknown-error/294554/5 "2026-05-15T18:17:06Z")

</div>

Closed on May 15, 2026, 6:17pm UTC

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