Skip to content

Fix: truncate long boss bar titles before sending to Bedrock#6501

Closed
andreiusq wants to merge 2 commits into
GeyserMC:masterfrom
andreiusq:fix/bossbar-long-title
Closed

Fix: truncate long boss bar titles before sending to Bedrock#6501
andreiusq wants to merge 2 commits into
GeyserMC:masterfrom
andreiusq:fix/bossbar-long-title

Conversation

@andreiusq

@andreiusq andreiusq commented Jul 2, 2026

Copy link
Copy Markdown

AI usage: I used an AI assistant (Claude Code) to help investigate the bug and write the fix, and to draft this description. I tested the change in-game myself and understand how it works.

Problem

Newer Bedrock clients (reported on protocol 1001 / MC 26.x) disconnect immediately after joining when they receive a boss bar with a very long title. Testing on the issue showed a 40 character title joins fine while a ~293 character one drops the connection right away. This shows up with plugins like TabTPS whose boss bar text can get very long when translation keys aren't resolved.

Fixes #6496

Change

BossBar now caps the title length before the packet is sent. If the cut would land in the middle of a color code I drop the trailing section sign so we don't send a broken formatting sequence, and the % escaping is done after the trim so an escape sequence can't be split.

Both the create and rename paths sent the same title, so I moved that conversion into a small bedrockTitle() helper instead of duplicating it.

The limit is set at 256, which is under the point where clients start dropping the connection and still far longer than any normal boss bar title.

Testing

Tested in-game on Paper with a Bedrock client: creating a boss bar with a 300+ character title (via /bossbar) no longer disconnects the client, and the title shows up truncated. ./gradlew :core:compileJava builds clean.

Some newer Bedrock clients (seen on protocol 1001) disconnect right
after joining when they receive a boss bar with a very long title.
A 40 character title works fine, but a ~293 character one kills the
connection.

Cap the title length in BossBar before it goes out, and strip a
trailing section sign if the cut lands in the middle of a color code
so we don't send a broken formatting sequence. Also pulled the
duplicated title conversion into a small helper since both the create
and rename paths needed the same fix.
@SleepyPopp

Copy link
Copy Markdown
Contributor

If you used any AI, please see our AI policy: https://github.com/GeyserMC/.github/blob/master/AI_POLICY.md

}
}
// Escape percent signs after truncating so we never split an escape sequence in half
return bedrockTitle.replace("%", "%%%%");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could result in titles being longer than 256 chars...

@andreiusq

andreiusq commented Jul 6, 2026

Copy link
Copy Markdown
Author

Good catch! escaping % to %%%% after truncating could grow the title right back past the limit. Fixed it.

Escaping "%" to "%%%%" after truncating to the length cap could grow
the title back past it, reintroducing the disconnect the truncation
was meant to prevent. Build the escaped output incrementally so the
cap is enforced on what's actually sent.
@andreiusq andreiusq force-pushed the fix/bossbar-long-title branch from c324022 to acb7849 Compare July 6, 2026 21:46
@Novampr Novampr closed this Jul 7, 2026
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.

Bedrock client (protocol 1001 / MC 26.x) disconnects on join when a long boss bar title is sent

4 participants