# Find which mod causes it in a Minecraft modpack

Find which mod in a Minecraft modpack logs a message, ships a duplicate class, mixes into a class, or implements an interface, with jdx from the terminal.

## Quick answer

Point `--jars` at the mods folder (`--jars mods` reads every jar in it, subfolders included; the quoted glob `--jars 'mods/*.jar'` reads only the jars directly inside it), add `--no-jdk`, and ask one question per command. Every row names the jar, so the answer is the mod file. Nothing is loaded or run.

```bash
jdx literals 'Failed to load config' --jars 'mods/*.jar' --no-jdk
jdx resolve com.example.lib.Config --jars 'mods/*.jar' --no-jdk
jdx annotated org.spongepowered.asm.mixin.Mixin --where 'value={net.minecraft.world.entity.Entity.class}' --jars 'mods/*.jar' --jars "$MIXIN_JAR" --no-jdk
jdx implementors net.fabricmc.api.ModInitializer --jars 'mods/*.jar' --jars "$LOADER_JAR" --no-jdk
```

A modpack is a folder of jars you did not write. When a log line, a crash, or a weird behaviour points at "some mod", the usual move is to unzip jars or bisect the folder by removing half the mods. jdx reads the bytecode of every jar in the folder at once and prints the jar on each row. It needs JDK 21 or later; install it with the [one-line installer](https://mohammadmd1383.github.io/jdx/docs/installation/). Reading one mod in depth (members, source, a decompiled method) is [Inspect a Minecraft mod jar](https://mohammadmd1383.github.io/jdx/docs/minecraft-mods/).

jdx does not remap. It answers in the names stored in each jar. Mods built for an obfuscated Minecraft version usually ship intermediary or SRG names (`class_1297`), so query those names, or pass the Loom-mapped Minecraft jar with `--jars` when you need the game's own classes. A `diff` only means something within one mapping namespace. A `not found` for a `net.minecraft` class says so with a `hint:` line: the game jar is missing from `--jars`.

The docs build has no modpack, so the recipes on this page are bash blocks and are not executed.

## Which mod logs this message?

`literals` searches string constants in bytecode: `LDC` loads, `String` constants, `.properties` keys and values, and Minecraft lang files. Paste a fixed part of the log line, without the variable parts. The same command finds which mod names an item or block: `jdx literals 'Ruby Gem' --jars mods --no-jdk` prints a `lang` row with the mod's translation key.

```bash
jdx literals 'Failed to load config' --jars 'mods/*.jar' --no-jdk
jdx literals 'Failed to load .* config' --regex --jars 'mods/*.jar' --no-jdk
```

Each hit prints the jar, then `class#method`, the string, and the source line when the jar has line numbers. Nothing matched exits 1. A message built at runtime from several pieces may not be one constant; search for the longest fixed piece. Reference: [`literals`](https://mohammadmd1383.github.io/jdx/docs/reference/literals/).

## Which jars ship the same class?

Two mods that bundle the same library, without relocating it, can crash with `NoSuchMethodError` or a linkage error. `resolve` lists every candidate for a name, one row per jar, and several candidates still exit 0.

```bash
jdx resolve com.example.lib.Config --jars 'mods/*.jar' --no-jdk
jdx search 'Config' --kind class --jars 'mods/*.jar' --no-jdk --limit 40
```

Fabric jar-in-jar libraries under `META-INF/jars/` (and Forge/NeoForge `META-INF/jarjar/`) are nested zip files. jdx opens them in memory, never on disk, and searches their classes and resources with the rest of the mod. Each hit names the outer mod and the nested path, such as `mod.jar!META-INF/jars/lib.jar`. `resources` lists which mod bundles which nested jar:

```bash
jdx resources META-INF/jars --jars 'mods/*.jar' --no-jdk
```

Reference: [`resolve`](https://mohammadmd1383.github.io/jdx/docs/reference/resolve/).

## Which mods mixin into this class?

A mixin class carries `@Mixin(targets)`. `annotated` lists every class with that annotation, and `--where` filters by the target. The Mixin annotation type itself must be on the classpath, so add the Mixin jar (`$MIXIN_JAR`, from the Loom cache or the loader's libraries) with a second `--jars`.

```bash
jdx annotated org.spongepowered.asm.mixin.Mixin --jars 'mods/*.jar' --jars "$MIXIN_JAR" --no-jdk --limit 100
jdx annotated org.spongepowered.asm.mixin.Mixin --where 'value={net.minecraft.world.entity.Entity.class}' --jars 'mods/*.jar' --jars "$MIXIN_JAR" --no-jdk
```

Each row prints the mixin class, its jar, and the annotation as written, for example `@org.spongepowered.asm.mixin.Mixin(value={net.minecraft.world.entity.Entity.class})`. The target name is whatever that jar stores, so a mod built against intermediary names matches `net.minecraft.class_1297`, not `Entity`. Before you add your own mixin, see who calls the method: [Find a Mixin target](https://mohammadmd1383.github.io/jdx/docs/minecraft-mixin-targets/).

## Which mods implement this interface?

`implementors` walks subtypes across every jar: entrypoints, event callbacks, API interfaces. Add the jar that declares the interface (the loader or an API mod) so the type resolves.

```bash
jdx implementors net.fabricmc.api.ModInitializer --jars 'mods/*.jar' --jars "$LOADER_JAR" --no-jdk
jdx hierarchy net.minecraft.world.entity.LivingEntity --down --jars "$MAPPED_JAR" --jars 'mods/*.jar' --no-jdk
```

A callback registered as a lambda or a method reference is not a subtype, so it is not in the class list. When the interface has any, `implementors` adds a second, marked section after the class rows, read from `invokedynamic` call sites in the bytecode:

```text
  subtypes in workspace (1)
    class examplemod.TickImpl  examplemod.jar
  lambdas and method references typed as this interface (2)
    lambda in examplemod.Hooks#init()  examplemod.jar
    method reference examplemod.Handlers#onTick() in examplemod.Wiring#wire()  examplemod.jar
```

Each row names the class that creates the callback and the method it does so in; a method reference also names the method it points to. A callback typed as a functional sub-interface adds `(as pkg.SubCallback)`, and several identical rows from one method print once with `x2`. `--json` carries them as `lambdas` (only when there are any), with `kind` `lambda` or `method-reference`. The JDK's own lambdas are not listed, and `--direct` keeps only callbacks typed as the interface itself. Reference: [`implementors`](https://mohammadmd1383.github.io/jdx/docs/reference/implementors/).

## Which mod is this, and what does it declare?

`resources --cat` prints one metadata file. With a glob, `fabric.mod.json` usually matches in every jar, which exits 2 with candidates; narrow it with `--in`.

```bash
jdx resources fabric.mod.json --jars 'mods/*.jar' --no-jdk
jdx resources fabric.mod.json --cat --in 'examplemod*' --jars 'mods/*.jar' --no-jdk
jdx resources mods.toml --cat --in 'examplemod*' --jars 'mods/*.jar' --no-jdk
```

`--cat` prints the file as stored and never validates it. To check the metadata instead, add `--check` (without `--cat`):

```bash
jdx resources --check --jars 'mods/*.jar' --no-jdk
jdx resources --check --in 'examplemod*' --jars 'mods/*.jar' --no-jdk
```

`--check` reads `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:

- JSON or TOML that does not parse, with the line and column.
- Required fields that are missing: `schemaVersion`, `id` and `version` for Fabric; `modLoader`, `loaderVersion`, `license` and `[[mods]]` with a `modId` for Forge and NeoForge.
- Entrypoint, mixin and mixin-plugin classes that are not in any opened jar, and mixin configs, refmaps and nested jars that are not in the same jar.
- Dependencies that no opened jar declares as its mod id or `provides`, including libraries already opened as nested jars (`META-INF/jars`, `META-INF/jarjar`, `BOOT-INF/lib`, `WEB-INF/lib`). Fabric `depends`, Quilt `depends` and required Forge or NeoForge dependencies count; optional ones, `minecraft`, `java` and the loaders do not. A dependency that is still absent keeps a warning. Issue #201.

```text
checked 2 metadata files: 2 errors, 1 warning
examplemod.jar
  examplemod.mixins.json (mixin config): 1 error
    error: mixin class examplemod.mixin.FooMixin (in 'mixins') is not on the classpath
  fabric.mod.json (fabric.mod.json): 1 error, 1 warning
    error: entrypoint 'main' class examplemod.Main is not on the classpath
    warning: dependency 'libmod' is not provided by any opened jar or nested 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.
```

Findings do not change the exit code: the command exits 0 when it checked at least one file and 1 when it found no metadata. Pass the whole mods folder in `--jars` so dependencies and classes can be found, including libraries bundled as jar-in-jar; jdx never downloads a missing dependency. It does not check version ranges. `--limit` caps how many files are listed, and `--json` carries every finding with its severity. Issue #179.

## Java 25 mods

Recent Minecraft versions and their mods target newer Java releases. jdx reads class files up to the newest version its bundled ASM knows (Java 27), even when jdx itself runs on JDK 21. Nothing in the jars is loaded. `--engine javap` is the exception: it runs the JDK's own `javap`, which needs a JDK at least as new as the class file.

## From an AI agent

The same questions work over MCP. Run `jdx setup --agent claude-code` (or another agent) once, then ask the agent which mod logs a message; it calls `jdx_literals` with the mods folder as `jars`. See [Use with AI agents](https://mohammadmd1383.github.io/jdx/docs/ai-agents/).

## FAQ

### How do I find which mod is causing a log message?

Run `jdx literals` with a fixed piece of the message and `--jars 'mods/*.jar'`. Each hit names the jar, the class and method that load the string, and the line. Nothing matched exits 1; try a shorter piece or `--regex`.

### How do I find duplicate classes in a modpack?

Run `jdx resolve` with the class name and `--jars 'mods/*.jar'`. It prints one row per jar that contains the class. Classes inside nested jar-in-jar libraries are searched too, so a library bundled by two mods shows as two rows, `a.jar!META-INF/jars/lib.jar` and `b.jar!META-INF/jars/lib.jar`. On commands with `--exclude` (`literals`, `resources`, `usages` and others), `--exclude 'META-INF/jars'` leaves nested jars out.

### How do I see which mods mixin into a Minecraft class?

Run `jdx annotated org.spongepowered.asm.mixin.Mixin` with `--where 'value={<target>.class}'`, the mods folder, and the Mixin jar on `--jars`. The target must be spelled in the names the mod jar stores, because jdx does not remap.

### Does jdx run or load the mods?

No. Bytecode is parsed with ASM and no class is loaded, so no mod code runs. Metadata files are printed as text.

### Does jdx remap intermediary or SRG names?

No. jdx answers in the names stored in each jar. Mapping files are phase-2 backlog. Query the names the jar uses, or pass the Loom-mapped Minecraft jar for the game's own classes.

## Where next

- [Inspect a Minecraft mod jar](https://mohammadmd1383.github.io/jdx/docs/minecraft-mods/) — members, source, and a decompiled method from one mod.
- [Find which mod adds an item or translation key](https://mohammadmd1383.github.io/jdx/docs/minecraft-translation-keys/) — in-game names and lang files.
- [Find a Mixin target](https://mohammadmd1383.github.io/jdx/docs/minecraft-mixin-targets/) — class, descriptor, callers, and an injection point.
- [See what changed between two Minecraft or mod versions](https://mohammadmd1383.github.io/jdx/docs/minecraft-version-diff/) — `diff` two jars in one namespace.
- [Find which JAR contains a class](https://mohammadmd1383.github.io/jdx/docs/find-class-in-jar/) — the same idea for any folder of jars.
- [Command catalogue](https://mohammadmd1383.github.io/jdx/docs/reference/) — every flag.
