A typo in fabric.mod.json, a mixin config that never made it into the jar, a client entrypoint renamed in code but not in metadata: the loader reports all of these, but only after you have started the game. In a big pack, that start can take a minute or more.

jdx is an open-source CLI and MCP server (Kotlin, Java 21+, Apache-2.0) that answers IDE-style questions about JVM jars without loading or running them. Since v1.8.5 (PR #198, issue #179), jdx resources --check reads the mod metadata inside the jars and reports problems before you launch.

curl -fsSL https://raw.githubusercontent.com/MohammadMD1383/jdx/main/install-release.sh | bash

(Windows: irm https://raw.githubusercontent.com/MohammadMD1383/jdx/main/install-release.ps1 | iex. Existing release installs update with jdx upgrade.)

--check looks at fabric.mod.json, quilt.mod.json, META-INF/mods.toml, META-INF/neoforge.mods.toml and mixin configs, plus the mixin configs those files name. It reports:

schemaVersion, id and version for Fabric; modLoader, loaderVersion, license and a [[mods]] entry with a modId for Forge and NeoForge.--jars provides. minecraft, java and the loaders themselves are skipped, and so are optional Forge/NeoForge dependencies. Each finding is an error or a warning.

To test it, I built three tiny jars:

examplemod-1.0.0.jar: its fabric.mod.json names a main entrypoint that exists, a client entrypoint that doesn't, two mixin configs (only one is in the jar) and depends on fabric-api and cloth-config. The mixin config that is in the jar has a trailing comma. cloth-config-15.0.140.jar: only a valid "id": "cloth-config". forgeymod-1.0.0.jar: a META-INF/mods.toml with an unclosed string on displayName, and a required dependency on jei.

jdx resources --check --jars mods --no-jdk
checked 4 metadata files: 4 errors, 1 warning
cloth-config-15.0.140.jar
  fabric.mod.json (fabric.mod.json): ok
examplemod-1.0.0.jar
  examplemod.mixins.json (mixin config): 1 error
    error: malformed JSON: line 8, column 3: unexpected character ']'
  fabric.mod.json (fabric.mod.json): 2 errors, 1 warning
    error: entrypoint 'client' class com.example.client.ExampleModClient is not on the classpath
    error: mixin config 'examplemod.client.mixins.json' is not in this jar
    warning: dependency 'fabric-api' is not provided by any opened jar (add it to --jars, or the game or loader supplies it)
forgeymod-1.0.0.jar
  META-INF/mods.toml (mods.toml): 1 error
    error: malformed TOML: line 8: unterminated string
note: --check reads metadata in place; use --cat to print a file raw. Nothing is downloaded.

Here's how to read it:

fabricloader aren't reported at all.] right after the trailing comma, and the TOML error points at the After fixing the comma and the quote and rebuilding the two jars, the same command goes one level deeper:

checked 4 metadata files: 3 errors, 2 warnings
cloth-config-15.0.140.jar
  fabric.mod.json (fabric.mod.json): ok
examplemod-1.0.0.jar
  examplemod.mixins.json (mixin config): 1 error
    error: mixin class com.example.mixin.ChatHudMixin (in 'mixins') is not on the classpath
  fabric.mod.json (fabric.mod.json): 2 errors, 1 warning
    error: entrypoint 'client' class com.example.client.ExampleModClient is not on the classpath
    error: mixin config 'examplemod.client.mixins.json' is not in this jar
    warning: dependency 'fabric-api' is not provided by any opened jar (add it to --jars, or the game or loader supplies it)
forgeymod-1.0.0.jar
  META-INF/mods.toml (mods.toml): 1 warning
    warning: dependency 'jei' is not provided by any opened jar (add it to --jars, or the game or loader supplies it)
note: --check reads metadata in place; use --cat to print a file raw. Nothing is downloaded.

TitleScreenMixin is in the jar, so only ChatHudMixin is reported. Missing fields look like this, for a neoforge.mods.toml whose [[mods]] entry has no modId:

checked 1 metadata file: 1 error, 0 warnings
neomod-2.0.0.jar
  META-INF/neoforge.mods.toml (neoforge.mods.toml): 1 error
    error: [[mods]] #1 is missing 'modId'
note: --check reads metadata in place; use --cat to print a file raw. Nothing is downloaded.

The usual resources filters work. --in limits the check to one jar, and the other jars still count as providers:

jdx resources --check --in 'examplemod*' --jars mods --no-jdk

That prints checked 2 metadata files: 3 errors, 1 warning with just the examplemod-1.0.0.jar section. A pattern works too: jdx resources --check fabric.mod.json --jars mods --no-jdk checks every fabric.mod.json and the mixin configs they name. --limit caps how many files are listed.

Findings don't change the exit code. The command exits 0 when at least one metadata file was checked, even with errors, and 1 when nothing matched:

$ jdx resources --check 'nothing-here.toml' --jars mods --no-jdk
not found: nothing-here.toml
no mod metadata matching 'nothing-here.toml'

(exit 1). --check together with --cat is a usage error (exit 3).

To fail a build, use --json, which carries every finding with its severity:

jdx resources --check --jars mods --no-jdk --json \
  | jq -r '.result.files[] | .artifact as $a | .findings[] | select(.severity=="error") | "\($a): \(.message)"'
examplemod-1.0.0.jar: mixin class com.example.mixin.ChatHudMixin (in 'mixins') is not on the classpath
examplemod-1.0.0.jar: entrypoint 'client' class com.example.client.ExampleModClient is not on the classpath
examplemod-1.0.0.jar: mixin config 'examplemod.client.mixins.json' is not in this jar

The summary also includes .result.errors and .result.warnings counts, so jq -e '.result.errors == 0' makes a one-line gate.

"cloth-config": ">=15" passes if any jar declares The MCP tool jdx_resources takes check, so after jdx setup --agent claude-code an agent can run the same check on a mods folder and read the findings as JSON.

The repo is at https://github.com/MohammadMD1383/jdx. The modpack guide covers the other questions, like which mod logs a message, ships a duplicate class or mixes into a class: https://mohammadmd1383.github.io/jdx/docs/minecraft-modpack/

原文来源:dev.to