
[1.21.1] Crash occurred when added a new Mekasuit module config in existing world.
gisellevonbingen opened this issue · 7 comments
Issue description
I'm tried to add a new module config to Mekasuit module in code at my mod.
https://mclo.gs/e46mZpY
It seems to be caused by the mismatch between the number of data stored in the NBT and the number of configurations in the module configuration codec.
Is there a way to avoid this problem?
Steps to reproduce
No response
Minecraft version
1.21.1 (Latest)
NeoForge version
21.1.133
Mekanism version
10.7.14 (Latest)
Other relevant versions
No response
If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)
From my testing it should be fixed in the above commit, and I will try to get an update out sometime in the next few days.
This is the variables when breakpoint is hit on the ItemStack is deserializing.
Saved nbt data count is 5, but I changed to registering config count is to 6.
The holder
is a module I added.
Thread [Server thread] (Suspended (breakpoint at line 59 in Module$InstalledData))
Module$InstalledData.create(List<ModuleConfig<?>>) line: 59
0x000001cbc5884478.apply(Object) line: not available
RecordCodecBuilder$Instance$1.lambda$decode$0(Object, Function) line: 185
0x000001cbc525e260.apply(Object) line: not available
DataResult$Success<R>.map(Function<? super R,? extends T>) line: 175
RecordCodecBuilder$Instance$1.lambda$decode$1(RecordCodecBuilder, DynamicOps, MapLike, Object) line: 184
0x000001cbc52536c0.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
RecordCodecBuilder$Instance$1.decode(DynamicOps<T>, MapLike<T>) line: 183
RecordCodecBuilder$2.decode(DynamicOps<T>, MapLike<T>) line: 107
KeyDispatchCodec<K,V>.lambda$decode$3(DynamicOps, MapLike, MapDecoder) line: 54
0x000001cbc542bd60.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
KeyDispatchCodec<K,V>.lambda$decode$4(DynamicOps, MapLike, Pair) line: 46
0x000001cbc542b460.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
KeyDispatchCodec<K,V>.decode(DynamicOps<T>, MapLike<T>) line: 45
KeyDispatchCodec<K,V>(MapDecoder<A>).lambda$compressedDecode$1(DynamicOps, MapLike) line: 52
0x000001cbc5250000.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
KeyDispatchCodec<K,V>(MapDecoder<A>).compressedDecode(DynamicOps<T>, T) line: 52
MapCodec$MapCodecCodec<A>.decode(DynamicOps<T>, T) line: 158
SequencedCollectionCodec$DecoderState<T>.accept(T) line: 79
0x000001cbc5877d88.accept(Object) line: not available
NbtOps.lambda$getList$24(ListTag, Consumer) line: 234
0x000001cbc560fad0.accept(Object) line: not available
SequencedCollectionCodec<E>.lambda$decode$2(DynamicOps, Consumer) line: 49
0x000001cbc5877930.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
SequencedCollectionCodec<E>.decode(DynamicOps<T>, T) line: 47
SequencedCollectionCodec<E>(Decoder<A>).parse(DynamicOps<T>, T) line: 18
FieldDecoder<A>.decode(DynamicOps<T>, MapLike<T>) line: 29
MapCodec$2.decode(DynamicOps<T>, MapLike<T>) line: 77
RecordCodecBuilder$Instance$3.decode(DynamicOps<T>, MapLike<T>) line: 248
RecordCodecBuilder$2.decode(DynamicOps<T>, MapLike<T>) line: 107
RecordCodecBuilder$2(MapDecoder<A>).lambda$compressedDecode$1(DynamicOps, MapLike) line: 52
0x000001cbc5250000.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
RecordCodecBuilder$2(MapDecoder<A>).compressedDecode(DynamicOps<T>, T) line: 52
MapCodec$MapCodecCodec<A>.decode(DynamicOps<T>, T) line: 158
EncoderCache$2.decode(DynamicOps<T>, T) line: 31
EncoderCache$2(Decoder<A>).parse(DynamicOps<T>, T) line: 18
DispatchedMapCodec<K,V>.lambda$parseEntry$6(DynamicOps, Pair, Codec) line: 59
0x000001cbc55fa8e8.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
DispatchedMapCodec<K,V>.parseEntry(DataResult<Unit>, DynamicOps<T>, Pair<T,T>, Map<K,V>, Builder<Pair<T,T>>) line: 59
DispatchedMapCodec<K,V>.lambda$decode$0(DynamicOps, Map, Stream$Builder, DataResult, Pair) line: 46
0x000001cbc55fa478.apply(Object, Object) line: not available
ReduceOps$1ReducingSink.accept(T) line: 80
ReferencePipeline$3$1.accept(P_OUT) line: 197
HashMap$EntrySpliterator<K,V>.forEachRemaining(Consumer<Entry<K,V>>) line: 1858
ReferencePipeline$3(AbstractPipeline<E_IN,E_OUT,S>).copyInto(Sink<P_IN>, Spliterator<P_IN>) line: 509
ReferencePipeline$3(AbstractPipeline<E_IN,E_OUT,S>).wrapAndCopyInto(S, Spliterator<P_IN>) line: 499
ReduceOps$1(ReduceOps$ReduceOp<T,R,S>).evaluateSequential(PipelineHelper<T>, Spliterator<P_IN>) line: 921
ReferencePipeline$3(AbstractPipeline<E_IN,E_OUT,S>).evaluate(TerminalOp<E_OUT,R>) line: 234
ReferencePipeline$3(ReferencePipeline<P_IN,P_OUT>).reduce(R, BiFunction<R,? super P_OUT,R>, BinaryOperator<R>) line: 667
DispatchedMapCodec<K,V>.lambda$decode$5(DynamicOps, Object, MapLike) line: 44
0x000001cbc55fa238.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
DispatchedMapCodec<K,V>.decode(DynamicOps<T>, T) line: 40
Decoder$2.decode(DynamicOps<T>, T) line: 63
Codec$2.decode(DynamicOps<T>, T) line: 75
Codec$2(Decoder<A>).parse(DynamicOps<T>, T) line: 18
OptionalFieldCodec<A>.decode(DynamicOps<T>, MapLike<T>) line: 34
MapDecoder$4.decode(DynamicOps<T>, MapLike<T>) line: 94
MapCodec$2.decode(DynamicOps<T>, MapLike<T>) line: 77
RecordCodecBuilder$Instance$5.decode(DynamicOps<T>, MapLike<T>) line: 325
RecordCodecBuilder$2.decode(DynamicOps<T>, MapLike<T>) line: 107
RecordCodecBuilder$2(MapDecoder<A>).lambda$compressedDecode$1(DynamicOps, MapLike) line: 52
0x000001cbc5250000.apply(Object) line: not available
DataResult$Success<R>.flatMap(Function<? super R,DataResult<R2>>) line: 201
RecordCodecBuilder$2(MapDecoder<A>).compressedDecode(DynamicOps<T>, T) line: 52
MapCodec$MapCodecCodec<A>.decode(DynamicOps<T>, T) line: 158
Codec$RecursiveCodec<T>.decode(DynamicOps<S>, S) line: 212
Codec$RecursiveCodec<T>(Decoder<A>).parse(DynamicOps<T>, T) line: 18
ItemStack.parse(Provider, Tag) line: 295
Inventory.load(ListTag) line: 448
ServerPlayer(Player).readAdditionalSaveData(CompoundTag) line: 824
ServerPlayer.readAdditionalSaveData(CompoundTag) line: 359
ServerPlayer(Entity).load(CompoundTag) line: 1894
IntegratedPlayerList(PlayerList).load(ServerPlayer) line: 337
IntegratedPlayerList(PlayerList).placeNewPlayer(Connection, ServerPlayer, CommonListenerCookie) line: 155
ServerConfigurationPacketListenerImpl.handleConfigurationFinished(ServerboundFinishConfigurationPacket) line: 188
ServerboundFinishConfigurationPacket.handle(ServerConfigurationPacketListener) line: 21
ServerboundFinishConfigurationPacket.handle(PacketListener) line: 8
PacketUtils.lambda$ensureRunningOnSameThread$0(PacketListener, Packet) line: 36
0x000001cbc57f7d70.run() line: not available
TickTask.run() line: 18
IntegratedServer(BlockableEventLoop<R>).doRunTask(R) line: 151
IntegratedServer(ReentrantBlockableEventLoop<R>).doRunTask(R) line: 24
IntegratedServer(MinecraftServer).doRunTask(TickTask) line: 881
IntegratedServer(MinecraftServer).doRunTask(Runnable) line: 170
IntegratedServer(BlockableEventLoop<R>).pollTask() line: 122
IntegratedServer(MinecraftServer).pollTaskInternal() line: 864
IntegratedServer(MinecraftServer).pollTask() line: 858
IntegratedServer(BlockableEventLoop<R>).managedBlock(BooleanSupplier) line: 135
IntegratedServer(MinecraftServer).managedBlock(BooleanSupplier) line: 830
IntegratedServer(MinecraftServer).waitUntilNextTick() line: 835
IntegratedServer(MinecraftServer).runServer() line: 718
MinecraftServer.lambda$spin$2(AtomicReference) line: 267
0x000001cbc56a5ad8.run() line: not available
Thread.runWith(Object, Runnable) line: 1596
Thread.run() line: 1583
can you set a breakpoint at the line that throws and inspect what the difference is?
Maybe the error is created by here:
Mekanism/src/api/java/mekanism/api/gear/ModuleConfigListCodec.java
Lines 31 to 41 in e5082f1
Stacktrace:
Thread [Server thread] (Suspended (breakpoint at line 34 in ModuleConfigListCodec))
owns: LocalCache$StrongAccessEntry<K,V> (id=225)
owns: Collections$SynchronizedRandomAccessList<E> (id=226)
ModuleConfigListCodec.encode(List<ModuleConfig<?>>, DynamicOps<T>, T) line: 34
ModuleConfigListCodec.encode(Object, DynamicOps, Object) line: 21
ModuleConfigListCodec(Encoder<A>).encodeStart(DynamicOps<T>, A) line: 14
OptionalFieldCodec<A>.encode(Optional<A>, DynamicOps<T>, RecordBuilder<T>) line: 44
OptionalFieldCodec<A>.encode(Object, DynamicOps, RecordBuilder) line: 17
MapEncoder$1.encode(B, DynamicOps<T>, RecordBuilder<T>) line: 26
MapCodec$2.encode(A, DynamicOps<T>, RecordBuilder<T>) line: 82
RecordCodecBuilder$Instance$2.encode(R, DynamicOps<T>, RecordBuilder<T>) line: 163
RecordCodecBuilder$2.encode(O, DynamicOps<T>, RecordBuilder<T>) line: 112
KeyDispatchCodec<K,V>.encode(V, DynamicOps<T>, RecordBuilder<T>) line: 74
MapCodec$MapCodecCodec<A>.encode(A, DynamicOps<T>, T) line: 163
MapCodec$MapCodecCodec<A>(Encoder<A>).encodeStart(DynamicOps<T>, A) line: 14
SequencedCollectionCodec<E>.encode(SequencedCollection<E>, DynamicOps<T>, T) line: 40
SequencedCollectionCodec<E>.encode(Object, DynamicOps, Object) line: 16
SequencedCollectionCodec<E>(Encoder<A>).encodeStart(DynamicOps<T>, A) line: 14
FieldEncoder<A>.encode(A, DynamicOps<T>, RecordBuilder<T>) line: 24
MapCodec$2.encode(A, DynamicOps<T>, RecordBuilder<T>) line: 82
RecordCodecBuilder$Instance$4.encode(R, DynamicOps<T>, RecordBuilder<T>) line: 222
RecordCodecBuilder$2.encode(O, DynamicOps<T>, RecordBuilder<T>) line: 112
MapCodec$MapCodecCodec<A>.encode(A, DynamicOps<T>, T) line: 163
MapCodec$MapCodecCodec<A>(Encoder<A>).encodeStart(DynamicOps<T>, A) line: 14
EncoderCache$Key<A,T>.resolve() line: 45
EncoderCache$1.load(Key<?,?>) line: 22
EncoderCache$1.load(Object) line: 20
LocalCache$LoadingValueReference<K,V>.loadFuture(K, CacheLoader<? super K,V>) line: 3571
LocalCache$Segment<K,V>.loadSync(K, int, LoadingValueReference<K,V>, CacheLoader<? super K,V>) line: 2313
LocalCache$Segment<K,V>.lockedGetOrLoad(K, int, CacheLoader<? super K,V>) line: 2190
LocalCache$Segment<K,V>.get(K, int, CacheLoader<? super K,V>) line: 2080
LocalCache<K,V>.get(K, CacheLoader<? super K,V>) line: 4012
LocalCache<K,V>.getOrLoad(K) line: 4035
LocalCache$LocalLoadingCache<K,V>.get(K) line: 5013
LocalCache$LocalLoadingCache<K,V>.getUnchecked(K) line: 5020
EncoderCache$2.encode(A, DynamicOps<T>, T) line: 37
EncoderCache$2(Encoder<A>).encodeStart(DynamicOps<T>, A) line: 14
DispatchedMapCodec<K,V>.encodeValue(Codec<V2>, V, DynamicOps<T>) line: 35
DispatchedMapCodec<K,V>.encode(Map<K,V>, DynamicOps<T>, T) line: 28
DispatchedMapCodec<K,V>.encode(Object, DynamicOps, Object) line: 20
Encoder$1.encode(B, DynamicOps<T>, T) line: 25
Codec$2.encode(A, DynamicOps<T>, T) line: 80
Codec$2(Encoder<A>).encodeStart(DynamicOps<T>, A) line: 14
OptionalFieldCodec<A>.encode(Optional<A>, DynamicOps<T>, RecordBuilder<T>) line: 44
OptionalFieldCodec<A>.encode(Object, DynamicOps, RecordBuilder) line: 17
MapEncoder$1.encode(B, DynamicOps<T>, RecordBuilder<T>) line: 26
MapCodec$2.encode(A, DynamicOps<T>, RecordBuilder<T>) line: 82
RecordCodecBuilder$Instance$6.encode(R, DynamicOps<T>, RecordBuilder<T>) line: 297
RecordCodecBuilder$2.encode(O, DynamicOps<T>, RecordBuilder<T>) line: 112
MapCodec$MapCodecCodec<A>.encode(A, DynamicOps<T>, T) line: 163
Codec$RecursiveCodec<T>.encode(T, DynamicOps<S>, S) line: 217
DataComponentUtil.wrapEncodingExceptions(T, Codec<T>, Provider, Tag) line: 24
ItemStack.save(HolderLookup$Provider, Tag) line: 415
Inventory.save(ListTag) line: 422
ServerPlayer(Player).addAdditionalSaveData(CompoundTag) line: 870
ServerPlayer.addAdditionalSaveData(CompoundTag) line: 402
ServerPlayer(Entity).saveWithoutId(CompoundTag) line: 1799
IntegratedPlayerList.save(ServerPlayer) line: 32
IntegratedPlayerList(PlayerList).remove(ServerPlayer) line: 371
ServerGamePacketListenerImpl.removePlayerFromWorld() line: 1239
ServerGamePacketListenerImpl.onDisconnect(DisconnectionDetails) line: 1228
Connection.handleDisconnection() line: 678
Connection.tick() line: 425
ServerConnectionListener.tick() line: 174
IntegratedServer(MinecraftServer).tickChildren(BooleanSupplier) line: 1066
IntegratedServer(MinecraftServer).tickServer(BooleanSupplier) line: 932
IntegratedServer.tickServer(BooleanSupplier) line: 113
IntegratedServer(MinecraftServer).runServer() line: 713
MinecraftServer.lambda$spin$2(AtomicReference) line: 267
0x0000023a296a6698.run() line: not available
Thread.runWith(Object, Runnable) line: 1596
Thread.run() line: 1583
Saved nbt data count is 5, but I changed to registering config count is to 6.
Yeah I thought it might be that
Workaround would be to use an nbt editor and remove the existing item from your world