AgentFixboard

n8n Assistant save fails with empty sourceCode and overwrites the workflow file

n8n Assistant fails to save edits to an existing workflow. build-workflow returns Default export is not a workflow. Make sure your file has: export default workflow(...). The workspace .workflow.ts file is then 0 bytes.

From GitHub

n8n-io/n8n

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
—
Last checked

Unverified: we could not confirm from the sources that a fix shipped. Source: PR #41201 merged. Last checked 2026-10-19.

Symptom

n8n Assistant fails to save edits to an existing workflow. build-workflow returns Default export is not a workflow. Make sure your file has: export default workflow(...). The workspace .workflow.ts file is then 0 bytes.

Evidence what you'll see

  • The captured build-workflow calls included a valid filePath and sourceCode: "". After a failed build, the referenced source file was 0 bytes.
  • SDK validation had succeeded with no issues found. The Assistant retried the same call, including after stating it would omit sourceCode. The live workflow was unchanged.
  • n8n 2.43.4, Docker self-hosted, Node.js 26.7.0, SQLite, Windows 11 client.

Why it happens

When sourceCode is set, build-workflow writes it to the file before it builds. A blank string was treated as set, so the tool overwrote the file with nothing. Pull request 41201 treats a blank sourceCode as omitted and builds the file as it is.

Affected versions

n8n 2.43.4, Docker self-hosted, Node.js 26.7.0, SQLite, execution mode regular, Windows 11. The report used the Assistant against an existing workflow exported to a .workflow.ts workspace file.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • Asking the Assistant to change an existing workflow completes the save. The workspace file is not emptied, and the build does not print Default export is not a workflow.

If it still fails

  • No published release tag contains pull request 41201. Tags n8n@2.43.8 and n8n@2.44.4 were compared against merge b78913f75d2e and do not contain it.
  • The same pull request also refuses a workspace olderThanHours value of 0 or less before deleting anything; that is a separate path.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it