n8n - 💡(How to fix) Fix Bug in .length function [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
n8n-io/n8n#29707Fetched 2026-05-05 06:03:09
View on GitHub
Comments
3
Participants
3
Timeline
6
Reactions
0
Author
Timeline (top)
commented ×3labeled ×1mentioned ×1subscribed ×1

Error Message

When using @json.output.length in a if node, I'm being told that '1000 ' is not a integer. There seems to be a leading space causing an error.

  • error: all
RAW_BUFFERClick to expand / collapse

When using @json.output.length in a if node, I'm being told that '1000 ' is not a integer. There seems to be a leading space causing an error.

<img width="2048" height="668" alt="Image" src="https://github.com/user-attachments/assets/ed26bad4-7511-4522-9892-13f87a629d17" />

I found a work around by multiplying it by 1

{{ ($json.output.length * 1) }}

<img width="1916" height="566" alt="Image" src="https://github.com/user-attachments/assets/9223bb32-6d1c-4470-9adb-0b492b0e685b" />

core

  • n8nVersion: 2.19.1
  • platform: docker (self-hosted)
  • nodeJsVersion: 24.14.1
  • nodeEnv: production
  • database: postgres
  • executionMode: regular
  • concurrency: -1
  • license: community

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 336 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/147.0.0.0 safari/537.36
  • isTouchDevice: false

security

  • secureCookie: false

Generated at: 2026-05-04T15:06:07.531Z

extent analysis

TL;DR

Remove the leading space from the @json.output.length value to fix the integer conversion error.

Guidance

  • Verify that the issue is indeed caused by a leading space in the @json.output.length value by checking the output of @json.output.length in a debug node.
  • Try using the trim() function to remove any leading or trailing whitespace from the @json.output.length value, e.g., {{ $json.output.length.trim() }}.
  • If the issue persists, try using a regular expression to remove any non-numeric characters from the @json.output.length value.
  • Consider reporting this issue to the n8n community or developers, as the workaround of multiplying by 1 may not be the most efficient solution.

Example

// Remove leading and trailing whitespace
{{ $json.output.length.trim() }}

// Remove non-numeric characters using a regular expression
{{ $json.output.length.replace(/[^0-9]/g, '') }}

Notes

The provided workaround of multiplying by 1 may work, but it does not address the root cause of the issue. The trim() function or regular expression approach may provide a more robust solution.

Recommendation

Apply the workaround using the trim() function or regular expression approach, as it is a more targeted solution to the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING