#Help Needed: `AssertionError` during `runDatagen` in Architectury Project

3 messages · Page 1 of 1 (latest)

obsidian leaf
#

I'm in the final stages of migrating my 1.21.1 Fabric mod, Adorable Hamster Pets to an Architectury project and have hit a wall with data generation. When I run the runDatagen task, the game crashes during initialization with an AssertionError.

The crash seems to be caused by my @ExpectPlatform method for registering entity spawn restrictions, although I'm a newbie so if anyone wants to double-check my diagnosis I would hugely appreciate it.

Full Crash Log

I've followed the standard @ExpectPlatform pattern, with an implementation for Fabric and one for NeoForge. The crash happens when the common code calls the @ExpectPlatform method.

I've double-checked my build.gradle files and the file paths for the implementation classes, but I can't spot the issue.

Here is the Full Repo

The relevant files are:

Any insight into why the AssertionError is being thrown would be greatly appreciated. Thank you!

obsidian leaf
#

Ok so I "solved" that issue by wrapping the runtime-only initializers (like entity spawn placements) in my common init() method with a check (System.getProperty("fabric-api.datagen") == null) to prevent them from running during data generation.

That allowed datagen to complete successfully, but now I'm facing the same AssertionError when trying to launch the actual Fabric client.

The Main Problem:
The Fabric client fails to launch, crashing with an AssertionError. This happens when my common init() method calls ModSpawnPlacements.register(), which is a method annotated with @ExpectPlatform. This indicates that the common placeholder method is being executed instead of the Fabric-specific implementation.

I have already tried cleaning the Gradle cache multiple times and have added the architectury common entrypoint to my fabric.mod.json, but the issue persists.

The Secondary Problem:
Separately, when I run ./gradlew build, the resulting Fabric JAR file is nearly empty (around 25 bytes) and only contains a META-INF folder. This suggests a problem with how the shadowJar task is configured in my fabric/build.gradle.

I'm sure it's a configuration issue I'm just not seeing. Would hugely appreciate if you took a look!