Skip to content

fix: prevent MixinTargetAlreadyLoadedException on startup#8

Open
dudematthew wants to merge 1 commit into
Globox1997:1.21from
dudematthew:fix/autoconfig-already-loaded
Open

fix: prevent MixinTargetAlreadyLoadedException on startup#8
dudematthew wants to merge 1 commit into
Globox1997:1.21from
dudematthew:fix/autoconfig-already-loaded

Conversation

@dudematthew

@dudematthew dudematthew commented May 17, 2026

Copy link
Copy Markdown

Fix: crash on startup with certain mod combinations

Fixes issue #2.

What was happening

LibZ has two mixins targeting classes inside cloth-config (AutoConfig and MarshallerImpl). Several mods load these classes during their preLaunch entrypoint. By the time LibZ's mixin subsystem tries to prepare those mixins, the targets are already in memory and can't be transformed anymore, resulting in a hard MixinTargetAlreadyLoadedException crash.

What did I change

AutoConfigAccess - replaced with a plain reflection helper. The mixin only ever read the private holders field from AutoConfig, which reflection handles identically since it's only called at runtime.

MarshallerImplMixin - removed. It was adding // client only comments to JSON config files, which is cosmetic. The actual client-only sync logic in EventInit and LibzClientPacket is unaffected. Worth noting that a proper replacement would be post-processing the JSON after serialization rather than hooking into MarshallerImpl directly - flagging in case you want to revisit.

LibzMixinPlugin - removed from the mixin config. All its methods were no-ops.

Tested with

  • levelz-2.1
  • levelz-fixes-1.3.1
  • lvlz_artifacts-1.21.1-1
  • lvlz_better_nether-1.21.1-1
  • lvlz_deeper_and_darker-2
  • lvlz_farmers_delight-2
  • lvlz_oh_the_biomes-2
  • partyaddon-1.5
  • jobsaddon-1.2.5
Full mod stack
  • Hybrid Aquatic 1.5.5
  • accessories-fabric-1.1.-beta.53+1.21.1
  • animatica-.6.1+1.21
  • antique-atlas-3.1.2+1.21
  • appleskin-fabric-mc1.21-3.6
  • architectury-13.8-fabric
  • armour-sound-tweak-updated-1.2-1.21
  • artifacts-fabric-13.2.1
  • atmosfera-2.5.7+mc1.21.1
  • balm-fabric-1.21.1-21.56
  • bclib-21.13
  • beekeeperhut-fabric-3.3+mc1.21.1
  • better_lib-fabric-1.21.1-1.19
  • betterendcities-1.
  • bettermounthud-1.2.4
  • better-nether-21.11
  • biolith-fabric-3.1
  • BOMD-1.1.2-1.21.1
  • bountiful-fabric-8.-beta.2
  • cardinal-components-api-6.1.3
  • Champions-1.6-1.21.1
  • citresewn-1.2.2+1.21
  • cloth-config-15.14-fabric
  • continuity-3.+1.21
  • coolrain-1.4.-1.21.1
  • Corgilib-Fabric-1.21.1-5.9
  • cristellib-fabric-1.21.1-3.3
  • cwb-fabric-3.+mc1.21
  • Dangerous Fabric - 1.21.1 v1.4.3
  • Debugify-1.21.1+1.
  • deeperdarker-fabric-1.21-1.3.3-plus-b
  • DistantHorizons-3.3-b-1.21.1-fabric-neoforge
  • Dungeons And Villages DeeperAndDarker 1.21.1
  • dynamic-fps-3.11.4+minecraft-1.21.-fabric
  • dynamicsurroundings-fabric-1.21.1-.4.2
  • e4mc-fabric-6.1.
  • ecologics-fabric-1.21.1-2.3.3
  • enchants-and-expeditions-1.21.1-v2.3.7
  • endrem-fabric-1.21.X-6.2
  • enhancedblockentities-.1.2+1.21
  • entity_model_features_1.21-fabric-3.1.1
  • entity_texture_features_1.21-fabric-7.1
  • entityculling-fabric-1.1.1-mc1.21.1
  • EuphoriaPatcher-1.8.6-r5.7.1-fabric
  • Explorify v1.6.4 f15-88.mod
  • fabric-api-.116.11+1.21.1
  • fabric-language-kotlin-1.13.1+kotlin.2.3.2
  • fabricskyboxes-.7.4+mc1.21
  • fabrishot-1.14.1
  • FallingTree-1.21.1-1.21.1.11
  • FarmersDelight-1.21.1-3.3.2+refabricated
  • fastquit-3.+1.2.6
  • ferritecore-7.3-fabric
  • fleeinganimals-4.+1.21
  • ForgeConfigAPIPort-v21.1.6-1.21.1-Fabric
  • friendsandfoes-fabric-4.25+mc1.21.1
  • fsb-interop-1.4.+mc1.21-build.54
  • fzzy_config-.7.6+1.21
  • galosphere_trimming-1.21.1-1.-fabric
  • Galosphere-1.21.1-1.5.3-Fabrirc
  • geckolib-fabric-1.21.1-4.8.4
  • Geophilic v3.4.6.mod
  • global-datapack-1.6.1
  • gravestones-1.3.+1.21+A
  • homeostatic-1.21.1-fabric-2.11.4
  • homeostaticseasons-1.21.1-fabric-1.1.5
  • ImmediatelyFast-Fabric-1.6.1+1.21.1
  • immersivelanterns-fabric-1.6-1.21.1
  • ImmersiveThunder-1.21.1+1.2.2
  • incapacitated-fabric-1.21.1-2.1
  • indium-1.35+mc1.21
  • iris-fabric-1.8.8+mc1.21.1
  • JEB-1.11-1.21.1
  • jobsaddon-1.2.5
  • jrftl-1.21-fabric-1.8.
  • kambrik-fabric-8.-beta.2
  • keepinventorypenalty-fabric-1.21.1-3.
  • lambdynamiclights-4.8.8+1.21.1
  • language-reload-1.7.6+1.21.1
  • levelz-2.1
  • levelz-fixes-1.3.1
  • libz-1.1.
  • lithium-fabric-.15.3+mc1.21.1
  • lithostitched-1.6.8-fabric-21.1
  • loot_n_explore-1.21-1.21.1
  • lvlz_artifacts-1.21.1-1.
  • lvlz_better_nether-1.21.1-1.
  • lvlz_deeper_and_darker-2.
  • lvlz_farmers_delight-2.
  • lvlz_oh_the_biomes-2.
  • main-menu-credits-1.2.
  • make_bubbles_pop-.3.-fabric-mc1.19.4-1.21
  • mcqoy-.4.1+fabric-1.2
  • midnightlib-fabric-1.9.2+1.21.1
  • mixintrace-1.1.1+1.17
  • modelfix-1.21-1.6-fabric
  • modernfix-fabric-5.25.1+mc1.21.1
  • modmenu-11.4
  • moonlight-1.21-2.29.33-fabric
  • morechathistory-1.3.1
  • moreculling-fabric-1.21.1-1.7
  • mru-1.19+LTS+1.21.1+fabric
  • NoChatReports-FABRIC-1.21.1-v2.9.1
  • nvidium-.3.1
  • Oh-The-Biomes-Weve-Gone-Fabric-2.5.5
  • Oh-The-Trees-Youll-Grow-fabric-1.21.1-5.3.
  • optigui-2.3.-beta.9+1.21
  • owo-lib-.12.15.4+1.21
  • paginatedadvancements-2.5.1
  • partyaddon-1.5
  • Ping-Wheel-1.12.2-fabric-1.21.1
  • placeholder-api-2.4.2+1.21
  • pneumonocore-1.3.1+1.21+A
  • polytone-1.21-3.6.6-fabric
  • progression-reborn-1.21.1-v1.5.11
  • puzzle-fabric-2.3.+1.21.1
  • reeses-sodium-options-fabric-1.8.3+mc1.21.4
  • regions-unexplored-.6+beta4-fabric-21.1
  • repurposed_structures_farmers_delight_compat_v7
  • repurposed_structures_friends_and_foes_compat_v9
  • repurposed_structures-7.5.2+1.21.1-fabric
  • Repurposed_Structures-Better_Monuments_v7
  • repurposed-end-2.1-1.21
  • resourcefullib-fabric-1.21-3.12
  • riverredux-fabric-.4.1
  • rrls-5.1+mc1.21.1-fabric
  • satisfying_buttons-fabric-1.1.2-1.21.1
  • sleep_tight-1.21-1.4.1-fabric
  • smarterfarmers-1.21-2.2.4-fabric
  • SnowUnderTrees-2.7.4+1.21.1
  • sodium-extra-fabric-.6.+mc1.21.1
  • sodium-fabric-.6.13+mc1.21.1
  • sodiumoptionsapi-fabric-1.1-1.21.1
  • sound-physics-remastered-fabric-1.21.1-1.5.1
  • sounds-2.4.22+lts+1.21.1-fabric
  • spiceoflife_classic-fabric-2.12+1.21.1
  • Structory_26.1_v1.3.16
  • structure_pool_api-fabric-1.2.1+1.21.1
  • SubtleEffects-fabric-1.21.1-1.14.2
  • surveyor-1.1.2+1.21
  • t_and_t-neoforge-fabric-1.13.7+1.21.1
  • TerraBlender-fabric-1.21.1-4.1.8
  • Terralith_1.21.x_v2.5.8
  • Terralith_ReStoned_v1.3.1
  • trashslot-fabric-1.21.1-21.1.4
  • travelersbackpack-fabric-1.21.1-1.1.35
  • trmt-.4-1.21+1.21.1
  • txnilib-fabric-1.24-1.21.1
  • underground_village-fabric-1.21.1-1.5.7
  • underground-rivers-1.2-fabric-21.1
  • undergroundworlds-fabric-3.1-1.21.1
  • void-totem-3
  • walllanterns-3.
  • waystones-fabric-1.21.1-21.1.32
  • worldweaver-21.13
  • yet_another_config_lib_v3-3.8.2+1.21.1-fabric
  • yosbr-.1.2
  • YungsApi-1.21.1-Fabric-5.1.6
  • YungsBetterEndIsland-1.21.1-Fabric-3.1.2
  • YungsBetterOceanMonuments-1.21.1-Fabric-4.1.2
  • YungsBetterWitchHuts-1.21.1-Fabric-4.1.1
  • YungsBridges-1.21.1-Fabric-5.1.1
  • YungsExtras-1.21.1-Fabric-5.1.1
  • zoomify-2.15.2+1.21.1
  • AutoConfigAccess and MarshallerImplMixin target classes from cloth-config
    (AutoConfig, MarshallerImpl) that get loaded too early by other mods during preLaunch causing a hard crash.
    
    - Replace AutoConfigAccess mixin with reflection-based AutoConfigHelper
    - Remove MarshallerImplMixin (was adding '// client only' comments to
      JSON configs, cosmetic only — sync logic unaffected)
    - Remove LibzMixinPlugin from mixin config (was all no-ops)
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant