Skip to content

Yoga warning: Measure function returned an invalid dimension [width=nan, height=nan] #517

Description

@v2naix

Summary

Running hunk diff prints many Yoga layout warnings to the terminal:

Measure function returned an invalid dimension to Yoga: [width=nan, height=nan]

The UI still appears to render, but stderr/stdout gets spammed with the warning repeatedly.

Environment

  • hunkdiff: 0.17.0
  • OS: macOS 26.5.1 / Build 25F80
  • Terminal: Ghostty 1.3.1
  • TERM=xterm-256color
  • COLORTERM=truecolor
  • Node wrapper installed via npm global package (hunk resolves to hunkdiff/bin/hunk.cjs)

Reproduction

In a git repo with a small working tree diff:

hunk diff

I can also reproduce with a minimal patch file:

cat >/tmp/minimal.patch <<'PATCH'
diff --git a/a.txt b/a.txt
index 0000000..1111111 100644
--- a/a.txt
+++ b/a.txt
@@ -1 +1 @@
-old
+new
PATCH

hunk patch /tmp/minimal.patch

Actual behavior

The terminal prints the warning many times, for example:

Measure function returned an invalid dimension to Yoga: [width=nan, height=nan]
Measure function returned an invalid dimension to Yoga: [width=nan, height=nan]
Measure function returned an invalid dimension to Yoga: [width=nan, height=nan]
...

Expected behavior

No Yoga invalid dimension warnings should be printed during normal rendering.

Notes

This happens both in a normal Ghostty terminal and in a nested/agent terminal environment. git diff itself works normally; the problem appears specific to Hunk's TUI rendering/layout path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions