moon icon indicating copy to clipboard operation
moon copied to clipboard

[bug] Error `data did not match any variant of untagged enum NodeState`

Open dmaretskyi opened this issue 1 month ago • 6 comments

Describe the bug

Moon crashes with data did not match any variant of untagged enum NodeState while running tasks.

Steps to reproduce

I don't have concrete steps to repro, but here's the snippet of workspaceGraph.json that failed to deserialize:

It's from workspaceGraph.json > project_graph > nodes > [1]

https://gist.github.com/dmaretskyi/bb00e0975a38673e239412ef75d97e99

From digging through the moon code I'm assuming it should be deserialized to Project

Environment

moon 1.41.5
proto 0.51.6
  System:
    OS: macOS 15.6.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 1.08 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.4.1 - /Users/dmaretskyi/.proto/shims/node
    npm: 11.4.2 - /Users/dmaretskyi/.proto/tools/node/24.4.1/bin/npm
    pnpm: 10.13.1 - /Users/dmaretskyi/.proto/shims/pnpm
    Deno: 2.1.10 - /opt/homebrew/bin/deno
  Managers:
    Cargo: 1.91.0 - /Users/dmaretskyi/.cargo/bin/cargo
    Homebrew: 4.6.19 - /opt/homebrew/bin/brew
    pip3: 25.0 - /opt/homebrew/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 17.0.0 - /usr/bin/gcc
    Git: 2.50.1 - /opt/homebrew/bin/git
    Git LFS: 3.6.1 - /opt/homebrew/bin/git-lfs
    Clang: 17.0.0 - /usr/bin/clang
    FFmpeg: 7.1 - /opt/homebrew/bin/ffmpeg
    Curl: 8.7.1 - /usr/bin/curl
    OpenSSL: 3.4.1 - /opt/homebrew/bin/openssl
  Servers:
    Apache: 2.4.62 - /usr/sbin/apachectl
    Nginx: 1.27.4 - /opt/homebrew/bin/nginx
  Virtualization:
    Docker: 28.3.0 - /usr/local/bin/docker
    Docker Compose: 2.38.1 - /usr/local/bin/docker-compose
  IDEs:
    VSCode: 1.5.11 - /usr/local/bin/code
    Claude Code: 1.0.11 - /Users/dmaretskyi/.npm-global/bin/claude
    Vim: 9.1 - /usr/bin/vim
    Xcode: /undefined - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Go: 1.24.0 - /opt/homebrew/bin/go
    Perl: 5.34.1 - /usr/bin/perl
    Protoc: 29.3 - /opt/homebrew/bin/protoc
    Python3: 3.13.2 - /opt/homebrew/bin/python3
    Ruby: 2.6.10 - /usr/bin/ruby
    Rust: 1.91.0 - /Users/dmaretskyi/.cargo/bin/rustc
  Databases:
    SQLite: 3.43.2 - /usr/bin/sqlite3
  Browsers:
    Chrome: 141.0.7390.123
    Safari: 18.6

dmaretskyi avatar Oct 31 '25 10:10 dmaretskyi

If you delete the cache does it start working again?

milesj avatar Oct 31 '25 15:10 milesj

If you delete the cache does it start working again?

@milesj Yes, if I delete the cache it runs fine

dmaretskyi avatar Nov 01 '25 12:11 dmaretskyi

Does this error consistently trigger after wiping the cache? It's a bit odd since NodeState should never exist in the cache, because that value only exists while the graph is being built, and only a fully built graph is cached.

milesj avatar Nov 01 '25 17:11 milesj

Did you downgrade moon perhaps after the cache was created? Or is there a mismatch in moon versions?

milesj avatar Nov 01 '25 18:11 milesj

Did you downgrade moon perhaps after the cache was created? Or is there a mismatch in moon versions?

That was it! My dev zsh had moon 1.41.7 while I was also calling a script (which I guess used bash) and it was runnning moon 1.40.5.

The error is on my side so the issue could be closed, I would only suggest adding a version number into the cache file itself to better handle this kind of issue.

dmaretskyi avatar Nov 12 '25 13:11 dmaretskyi

We do in some places, but I may have missed one. I'll look into it. Thanks for verifying!

milesj avatar Nov 12 '25 17:11 milesj