[GH-ISSUE #264] Format strings that evaluate to one character long don't work and stop further updates from happening #1646

Open
opened 2026-05-23 03:58:19 +01:00 by JakeStanger · 2 comments
Owner

Originally created by @emersonrp on GitHub (Mar 24, 2026).
Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/264

The track in question in this case was Public Image Ltd, "Happy?" from their album "9".

Apparently Discord needs at least two characters for the things it gets sent. This shows up in the logs:

Mar 23 21:15:17 mergatroid mpd-discord-rpc[1272059]: 2026-03-24T01:15:17.647681Z ERROR mpd_discord_rpc: ErrorEvent { code: Some(4000), message: Some("child "activity" fails because [child "state" fails because ["state" length must be at least 2 characters long]]") }

...and the service is then seized up and won't proceed until it's restarted.

I wrote a hackish script to do this mpd<->discord business a couple years ago and I recall having to space-pad anything less than two characters long, just to get Discord not to break.

Edit to add:
I have fiddled with config.toml, which looks like this. Note that yeah, 'state' only contains the album name. I suspect that with the default configuration, though, single-character song titles would break the same way.

[format]
details = "$artist / $title"
state = "$album"
timestamp = "both"
large_image = "notes"
small_image = "notes"
large_text = ""
small_text = ""
display_type = "details"

Originally created by @emersonrp on GitHub (Mar 24, 2026). Original GitHub issue: https://github.com/JakeStanger/mpd-discord-rpc/issues/264 The track in question in this case was Public Image Ltd, "Happy?" from their album "9". Apparently Discord needs at least two characters for the things it gets sent. This shows up in the logs: Mar 23 21:15:17 mergatroid mpd-discord-rpc[1272059]: 2026-03-24T01:15:17.647681Z ERROR mpd_discord_rpc: ErrorEvent { code: Some(4000), message: Some("child \"activity\" fails because [child \"state\" fails because [\"state\" length must be at least 2 characters long]]") } ...and the service is then seized up and won't proceed until it's restarted. I wrote a hackish script to do this mpd<->discord business a couple years ago and I recall having to space-pad anything less than two characters long, just to get Discord not to break. Edit to add: I have fiddled with config.toml, which looks like this. Note that yeah, 'state' only contains the album name. I suspect that with the default configuration, though, single-character song titles would break the same way. > [format] > details = "$artist / $title" > state = "$album" > timestamp = "both" > large_image = "notes" > small_image = "notes" > large_text = "" > small_text = "" > display_type = "details" >
Author
Owner

@fxzzi commented on GitHub (May 1, 2026):

we already extend the length of the "details" with a zero-width space to avoid this: https://github.com/JakeStanger/mpd-discord-rpc/pull/229

doing the same in this case would probably be fine

<!-- gh-comment-id:4360640907 --> @fxzzi commented on GitHub (May 1, 2026): we already extend the length of the "details" with a zero-width space to avoid this: https://github.com/JakeStanger/mpd-discord-rpc/pull/229 doing the same in this case would probably be fine
Author
Owner

@JakeStanger commented on GitHub (May 1, 2026):

Yep, happy to apply that logic everywhere it applies

<!-- gh-comment-id:4361108414 --> @JakeStanger commented on GitHub (May 1, 2026): Yep, happy to apply that logic everywhere it applies
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/mpd-discord-rpc#1646
No description provided.