Bug KoLmafia going into mobile mode

dapanda

Member
I am getting a weird issue, where KoLmafia gets stuck in mobile mode. I don't enable it and in the options menu I can't turn if off. Here is the Debug report when I try to turn off mobile mode in the browser (not sure if this is a normal error when trying to disable under options)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
KoLmafia r28545, Linux, Java 21.0.5
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Please note: do not post this log in the KoLmafia thread of KoL's
Gameplay-Discussion forum. If you would like the KoLmafia dev team
to look at it, please write a bug report at kolmafia.us. Include
specific information about what you were doing when you made this
and include this log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Timestamp: Mon Jun 02 08:59:12 MST 2025
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
User: dapanda
Current run: 198
MRU Script: Unknown
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.lang.StringIndexOutOfBoundsException: Range [-1, 4356) out of bounds for length 4356
java.lang.StringIndexOutOfBoundsException: Range [-1, 4356) out of bounds for length 4356
at java.base/jdk.internal.util.Preconditions$1.apply(Unknown Source)
at java.base/jdk.internal.util.Preconditions$1.apply(Unknown Source)
at java.base/jdk.internal.util.Preconditions$4.apply(Unknown Source)
at java.base/jdk.internal.util.Preconditions$4.apply(Unknown Source)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Unknown Source)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Unknown Source)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Unknown Source)
at java.base/java.lang.String.checkOffset(Unknown Source)
at java.base/java.lang.AbstractStringBuilder.insert(Unknown Source)
at java.base/java.lang.StringBuffer.insert(Unknown Source)
at net.sourceforge.kolmafia.webui.CharPaneDecorator.decorateEffects(CharPaneDecorator.java:821)
at net.sourceforge.kolmafia.webui.CharPaneDecorator.decorate(CharPaneDecorator.java:106)
at net.sourceforge.kolmafia.RequestEditorKit.applyPageAdjustments(RequestEditorKit.java:272)
at net.sourceforge.kolmafia.RequestEditorKit.getFeatureRichHTML(RequestEditorKit.java:259)
at net.sourceforge.kolmafia.RequestEditorKit.getFeatureRichHTML(RequestEditorKit.java:174)
at net.sourceforge.kolmafia.request.RelayRequest.formatResponse(RelayRequest.java:432)
at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1185)
at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:4057)
at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:243)
at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:208)
at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:442)
at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:103)
at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:83)

-I normally never log into KoL via the browser, without mafia, and for the last 2 weeks I have only used mafia.
-When this happens I am running a script, I have not previously visited mafia via the browser.
-I have not started the relay browser (but it would also when when the relay browser was automatically started via my script)
-I have looked through the preference file and have not seen anything that would point to a setting searched the terms (mobile, browser, desktop).

I also attached a screenshot of what I see and the error that comes up in mafia which causes the script abort. The only way I have found to fix it is to update KoLmafia and that sometimes works, but today it didn't change anything.

Update: Restarting the computer fixed the kolmafia issue with the mobile desktop issue but not the error from the screenshot: "Bad location value: Battlefield (No Uniform); if you're certain that this Location exists and is spelled correctly, please update KoLMafia" So those most likely were independent.
 

Attachments

  • Screenshot 2025-06-02 090700.png
    Screenshot 2025-06-02 090700.png
    248.4 KB · Views: 11
Last edited:
At to this as I have now had it happen on another computer / account that I run kolmafia.jar on.

I was just running my daily script that automatically starts up. This was the first time I have seen it on this computer and I have been running the same script with no updates to the script since the mafia update.

From the gCLI It was trying to change the outfit:

Putting on outfit: Buffbot
<img style='vertical-align: middle' class=hand src='https://d2uyhvukfffg5a.cloudfront.net/itemimages/magnet.gif' onclick='descitem(582822524)'> moxie magnet

KoLmafia r28623, Linux, Java 21.0.8

Code:
Unexpected error, debug log printed.
class java.lang.StringIndexOutOfBoundsException: Range [-1, 3099) out of bounds for length 3099
java.lang.StringIndexOutOfBoundsException: Range [-1, 3099) out of bounds for length 3099
    at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
    at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
    at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
    at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
    at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
    at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
    at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
    at java.base/java.lang.String.checkOffset(String.java:4840)
    at java.base/java.lang.AbstractStringBuilder.insert(AbstractStringBuilder.java:1186)
    at java.base/java.lang.StringBuffer.insert(StringBuffer.java:557)
    at net.sourceforge.kolmafia.webui.CharPaneDecorator.decorateEffects(CharPaneDecorator.java:821)
    at net.sourceforge.kolmafia.webui.CharPaneDecorator.decorate(CharPaneDecorator.java:106)
    at net.sourceforge.kolmafia.RequestEditorKit.applyPageAdjustments(RequestEditorKit.java:272)
    at net.sourceforge.kolmafia.RequestEditorKit.getFeatureRichHTML(RequestEditorKit.java:259)
    at net.sourceforge.kolmafia.RequestEditorKit.getFeatureRichHTML(RequestEditorKit.java:174)
    at net.sourceforge.kolmafia.request.RelayRequest.formatResponse(RelayRequest.java:432)
    at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1185)
    at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:4057)
    at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:243)
    at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:208)
    at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:442)
    at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:103)
    at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:83)
 
Update: Restarting the computer fixed the kolmafia issue with the mobile desktop issue but the error from the screenshot: "Bad location value: Battlefield (No Uniform); if you're certain that this Location exists and is spelled correctly, please update KoLMafia" So those most likely were independent.

That message is generated when a script has not been updated since KoLmafia changed some location names. If I remember correctly the message is different if KoLmafia can figure out the location and continue, so that message may mean a script is aborting rather than completing normally which could have a cascading effect.

I see a similar stack trace from the RelayBrowser about once a week with multiple characters. My hypothesis is that a script (that they all use) is getting data that it doesn't like but I have not really seen any effect besides the message so I have not tracked it down. Maybe I should try to do so.

Putting on outfit: Buffbot
<img style='vertical-align: middle' class=hand src='https://d2uyhvukfffg5a.cloudfront.net/itemimages/magnet.gif' onclick='descitem(582822524)'> moxie magnet

That suggests to me that something that was parsing HTML was passed something it didn't expect. Usually that means the KoL has changed something and the parsing - in the script or KoLmafia - needs to be adjusted.

Stand by.
 
There is a preference that will log when preferences change. I set it and tried going into mobile mode. No preference changed. Of course neither did my display in the relay browser and when I revisited options the toggle was still set to enter mobile mode and not set to enter desktop. Not sure what is going on but inclined to say that KoLmafia preferences are not forcing mobile mode.

I note in your screenshot the address bar has an orange box by it. What does that mean? It also looks like the connection is not secure but that seems to be normal.

I did a plain login, set things to mobile, saw the mobile display, logged out, logged in with KoLmafia and the relay browser showed the desktop version. I couldn't get it to show mobile.

I am perplexed but wonder whether there are browser settings or cookies or locally stored data that are a factor. I might try and clear/delete anything the browser knows about KoL and KolMafia and see what happens. I'd also wonder about a trying a different browser and/or trying to run KoLmafia as a different Linux user. But grasping at straws here...
 
I will expand on my setup as it is a little different than others (and that could be part of the issue):

Setup 1:
-Primary account - Raspberry PI 4: OS 11
-Keep mafia relatively up to date along with scripts
-Loops every day - Uses an assortment of scripts
-Has the "Allow network devices to access relay browser) option checked and does not run "relay nobrowser" unless I need to access it.

Setup 2:
-Buffbot for clan - Raspberry PI 4: OS 11
-Update Mafia and scripts about once a month
-I attached the script it uses (Other than the custom work it uses CONSUME, minevolcano, and RecordSongs.ash)
-Just finished ascending 18 days ago and won't again
-Has the "Allow network devices to access relay browser) option checked and runs the "relay nobrowser" every day at the start of the script

Setup 1 gets the mobile display issue about once a week and that is without accessing it in the browser.

Setup 2 has got that mobile display issue once (when I posted above). The error I got the one time:

Putting on outfit: Buffbot
<img style='vertical-align: middle' class=hand src='https://d2uyhvukfffg5a.cloudfront.net/itemimages/magnet.gif' onclick='descitem(582822524)'> moxie magnet

has never happened before or since.

-Both Raspberry pis are only used for mafia and I don't go to any other website than the 127.0.0.1:60080/game.php on them.
-I never go into "mobile mode" and only play both accounts through mafia.
-Sometimes I will access the mafia URL on my phone but that is only after mafia has an issue with running.
-I use Edge, chrome (Windows), chromium (Linux) to play but that mobile issue only comes up before I actually load the URL in the browser, so the browser versions shouldn't have anything to do with it.
-Once the issue happens, it happens on all browsers, across all OSs.

I note in your screenshot the address bar has an orange box by it. What does that mean? It also looks like the connection is not secure but that seems to be normal.
Yea that is an unsecure connection, that has always shown up that way when using mafia.
 

Attachments

Last edited:
Back
Top