[SPIGOT-6831] Papa Llama Drama (Ticking entity, trader_llama pathfinding) Crashed Minecraft Server (java.lang.IllegalArgumentException: bound must be positive) Created: 02/Dec/21  Updated: 06/Dec/21  Resolved: 06/Dec/21

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Justin Gehring Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: Llama, Pathfinder, crash, server
Environment:

Operating System: Linux (amd64) version 5.4.0-74-generic (Ubuntu)
Java Version: 17.0.1

See full details in crash log.


Attachments: Text File 2021-12-02-3.log     Text File crash-2021-12-02_03.28.40-server.txt     Text File crash-2021-12-02_18.39.24-server.txt     Text File crash-2021-12-02_22.32.12-server.txt     Text File crash-2021-12-03_03.14.01-server.txt     Text File crash-2021-12-03_05.07.58-server.txt     Zip Archive silvertown.zip    
Version: This server is running CraftBukkit version 3339-Spigot-3c40a6c-581df18 (MC: 1.18) (Implementing API version 1.18-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Issue: Server crashes with error "java.lang.IllegalArgumentException: bound must be positive
    at java.base/java.util.Random.nextInt(Random.java:322)
    at net.minecraft.world.entity.animal.horse.EntityLlama.b(SourceFile:411) ..." (see attached crash logs.

Not sure if this is an error in the Minecraft codebase, or Spigot. 

Seems to happen within seconds of a player getting in range of a fenced-in trader llama farm on our server.

Was not able to reproduce on a new world (yet, still trying)

 

3 Crash logs attached, along with a log file.

 

 



 Comments   
Comment by md_5 [ 03/Dec/21 ]

I had your world loaded for a few hours no issues, which is odd.
I've also looked at the code and they 100% should be getting set to Strength 1 on load. The Mojang you linked suggests the same...

I am really confused about this issue.

And yes, the crash happens when they try to breed.

Comment by Justin Gehring [ 03/Dec/21 ]

So, a little follow up in case it helps in the future, or helps isolate what is actually going on... More confused than ever... 

I built a new fresh install (nothing was brought over from the old one, except the world file that you used as well), loaded in the world from the zip file, and it crashed for me again. No plugins, nothing carried over. I'm including the crash log from that round of testing: crash-2021-12-03_03.14.01-server.txt

However, we then restarted spigot, and someone else logged in first, and it was stable for them. I then logged in and it kept running. We only tested for about 5 minutes, so it's possible it would have crashed eventually, but it felt stable... the best luck we had had so far.

We restarted our normal server (with all the plugins) and ran the same test... Had the other person log in first. It crashed on them before I could get in.

We then copied the world folder from the working server to the not working server, and suddenly it was stable... For about 15 minutes. We then had a third player join, and for a brief bit it seemed to work, but then crashed again. Here's that log file: crash-2021-12-03_05.07.58-server.txt

So after all of that, we have tried one last resort: we have murdered all the  trader_llama's. So far we have 30 minutes of uptime since their death... so that does seem to at least be a solution. 

A few other notes that might help isolate what was going on:

  • These trader llama's were leashed to fences.  It sounds like this might be the source of the strength 0?
  • We went hunting for similar errors on the Mojang bug report: We weren't breeding when it was happening, but there was a very similar sounding bug on Mojang at one point (long ago) (https://bugs.mojang.com/browse/MC-107683)

 

 

 

Comment by Justin Gehring [ 03/Dec/21 ]

So another follow up - and this is pointing more towards some plugin possibly going nuts... After changing all the stengths of the llama's to 2, they all reset back to 0.

Will run a test without any plugins here shortly.

Comment by md_5 [ 03/Dec/21 ]

You sure? I downloaded the world and /data get entity @e[limit=1,type=minecraft:trader_llama] shows strength 1 for me.

I'll leave your world loaded for a bit and see if it crashes, but its ok for me right now.

Did you try without plugins?

Comment by Justin Gehring [ 03/Dec/21 ]

So strangely ALL the llama's in this world had strength 0. I'm attaching a zip of the world folder. We're 99% certain they were not summoned in by a player after checking logs, etc.

Comment by md_5 [ 03/Dec/21 ]

It's odd though because when they load they should default to 1. Can you include part of the world so I can try?

Comment by Justin Gehring [ 03/Dec/21 ]

You do appear to be correct that the strength on 2 of the llamas is 0. I am not sure of the cause, or if these llama's existed prior to the 1.18 update. Will update with any other information that I can figure out how they got to be 0 strength.

Comment by Justin Gehring [ 02/Dec/21 ]

Ok, before I'll kill llama's, I'll copy the world, and load it plugin free. will be a little bit.

Comment by md_5 [ 02/Dec/21 ]

See what their strength value is:

Entity Name: Mama Llama
Entity's Exact location: -23.75, 65.00, -92.40
Entity's Block location: World: (-24,65,-93), Section: (at 8,1,3 in -2,4,-6; chunk contains blocks -32,-64,-96 to -17,319,-81), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,-64,-512 to -1,319,-1)

I looked at the code, and it does prevent strength outside range [0, 5] which makes me think plugin bypassing this restriction.

Comment by Justin Gehring [ 02/Dec/21 ]

To my knowledge, no one had the ability/power to do that on this box other than myself. That said, I'll do some more investigation and kill off the llamas in the meantime.  

I"ll try to pull out NBTExplorer on the world file and see if I can find the offending llama(s) (as it appears to have been more than one). 

Comment by md_5 [ 02/Dec/21 ]

Hmmm I don't see how this is possible without a plugin, strength should always be >= 1.
Can you load the world without plugins and see if it crashes?

Comment by md_5 [ 02/Dec/21 ]

Someone used a command to create a llama with 0 or negative strength

Generated at Fri Mar 14 17:40:40 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.