moon: [bug] Moon-Proto version mismatch causes JSON parsing error in GitHub Actions
Read more for fix: https://github.com/moonrepo/moon/issues/2058#issuecomment-3093189499
Describe the bug
When using Moon 1.38.6 with Proto 0.50.5 in GitHub Actions, Moon fails to parse Proto’s manifest file due to incompatible JSON schema versions.
Moon stops running the pipeline and fails with the following:
Error: json::parse_file
× Failed to parse JSON file ~/.proto/tools/node/manifest.json.
╰─▶ unknown field `spec`, expected one of `backend`, `checksum`, `source` at
line 11 column 14
Seems to be some sort of breaking change that has changed the schema of the manifest file and moon is not expecting it.
Steps to reproduce
- Create
.prototoolsfile:
moon = "1.38.6"
proto = "0.50.5"
[settings]
auto-clean = true
auto-install = true
- Create a
.moon/toolchain.ymlfile (typescript can be left out):
$schema: ./cache/schemas/toolchain.json
node:
packageManager: yarn
version: 22.15.0
addEnginesConstraint: true
syncPackageManagerField: true
yarn:
version: 4.9.2
typescript:
syncProjectReferences: false
includeSharedTypes: false
- Create your github action and setup the environment
- Use the environment and configure a job that will run
moon ci - You should see the pipeline break and show a json parsing error
Expected behavior
- Moon detects the project structure and identifies all TypeScript projects in the workspace
- Moon uses Proto to find Node.js - it should detect the Proto-managed Node.js 22.15.0 installation
- Moon runs TypeScript compilation for all affected TypeScript projects using the detected Node.js version
- TypeScript compiler executes using Node.js 22.15.0 to compile .ts files to .js files
- Build succeeds with compiled output in dist/ directories
Screenshots
Environment
System:
OS: Linux 6.11 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (2) x64 AMD EPYC 7763 64-Core Processor
Memory: 6.90 GB / 7.76 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.15.0 - ~/.proto/shims/node
Yarn: 4.9.2 - ~/.proto/shims/yarn
npm: 10.8.2 - /usr/local/bin/npm
Managers:
Apt: 2.8.3 - /usr/bin/apt
Cargo: 1.88.0 - ~/.cargo/bin/cargo
Composer: 2.8.9 - /usr/bin/composer
Gradle: 8.14.3 - /usr/bin/gradle
Maven: 3.9.10 - /usr/bin/mvn
pip3: 24.0 - /usr/bin/pip3
RubyGems: 3.4.20 - /usr/bin/gem
Utilities:
Bazel: 8.3.1 - /usr/local/bin/bazel
CMake: 3.31.6 - /usr/local/bin/cmake
Make: 4.3 - /usr/bin/make
GCC: 13.3.0 - /usr/bin/gcc
Git: 2.50.1 - /usr/bin/git
Clang: 18.1.3 - /usr/bin/clang
Ninja: 1.13.0 - /usr/local/bin/ninja
Mercurial: 6.7.2 - /usr/bin/hg
Curl: 8.5.0 - /usr/bin/curl
OpenSSL: 3.0.13 - /usr/bin/openssl
Servers:
Nginx: 1.24.0 - /usr/sbin/nginx
Virtualization:
Docker: 28.0.4 - /usr/bin/docker
SDKs:
Android SDK:
API Levels: 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 36
Build Tools: 34.0.0, 35.0.0, 35.0.1, 36.0.0
Android NDK: 27.2.12479018
IDEs:
Nano: 7.2 - /usr/bin/nano
Vim: 9.1 - /usr/bin/vim
Languages:
Bash: 5.2.21 - /usr/bin/bash
Go: 1.24.4 - /usr/bin/go
Java: 17.0.15 - /usr/bin/javac
Perl: 5.38.2 - /usr/bin/perl
PHP: 8.3.6 - /usr/bin/php
Python: 3.12.3 - /usr/bin/python
Python3: 3.12.3 - /usr/bin/python3
Ruby: 3.2.3 - /usr/bin/ruby
Rust: 1.88.0 - /home/runner/.cargo/bin/rustc
Databases:
MySQL: 0.24.04.1 - /usr/bin/mysql
SQLite: 3.45.1 - /usr/bin/sqlite3
Browsers:
Chrome: 138.0.7204.100
Chromium: 138.0.7204.0
Monorepos:
Yarn Workspaces: 4.9.2
Additional context
I am using proto and moon in a new production service repository. It would be great to gain better understanding of this. I have multiple different combinations from moon v1.38.1 - v1.38.6 with proto v0.50.1 - 0.51.1
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 25
In summary:
Why did this error happen?
proto has been working on a lockfile implementation for a while now, since v0.48. There were internal changes within the tool
manifest.jsonthat didn’t allow unknown fields, which is a pretty typical pattern, and would error when deserializing. However, in v0.51 we released unstable lockfiles, but this also included new fields in the manifest, primarilyspecandversion.This problem arises because moon is hard-coded to a specific proto version, in this case, < v0.51. So if a user has proto >= v0.51 installed globally and installs a tool, it will modify the manifest and inject these new fields. But because moon is using an older proto version, it doesn’t support/allow these new fields, triggering the error.
How to solve the issue?
This requires updating both moon and proto. For moon, you must use >= v1.38.6, and the global proto must use >= v0.51.2.
If for some reason you are unable to upgrade moon to the latest version, you should be able to use any proto version except for v0.51.0 and v0.51.1 without issue.
Ok I upgraded, but the error still triggers!
Run both tools with logging enabled (
MOON_LOG=trace PROTO_LOG=trace) to determine that the correct executables and versions are being used.If all else fails, you can modify
manifest.jsonmanually and remove thespecandversionfields from alllockrecords. This is a safe change.I can confirm this is still an issue