Skip to content

fix READY being discarded when application_id is null - #427

Merged
ouwou merged 2 commits into
uowuo:masterfrom
Soashivito:fix-nullable-application-id
Sep 9, 2026
Merged

ouwou merged 2 commits into
uowuo:masterfrom
Soashivito:fix-nullable-application-id

Conversation

@Soashivito

Copy link
Copy Markdown
Contributor

Abaddon starts, connects, and then sits there with an empty window. No servers or channels.
The process stays alive and the gateway connection holds, so it looks like it is still loading. the console shows this tho:

`error handling message (opcode 0): [json.exception.type_error.302] type must be number, but is null`

whats happening is that the whole READY gets thrown away, so no guilds or channels load.
everything after READY parses fine, which is why the error only shows up once.

I put a websocket proxy between Abaddon and the gateway to capture the payload. Discord now sends "application_id": null on voice channels instead of leaving the key out. In my READY, 59 of 4461 channels had it, all of them type 2.
ChannelData reads that key with JS_O:

    // src/discord/channel.cpp:38
    JS_O("application_id", m.ApplicationID);

JS_O checks contains() and nothing else. The key is there, so it calls get(), and Snowflake::from_json takes the non string branch:

    // src/discord/snowflake.cpp:69
    if (j.is_string()) { ... }
    else j.get_to(s.m_num);   // uint64_t <- null

this switches both sites to JS_ON: channel.cpp:38 and activity.cpp:69.
the activity one is not what breaks for me, but it reads the same optional the same way, and it will hit this the first time someone's rich presence comes through with a null application_id.

discord sends "application_id": null on voice channels, but JS_O only
checks contains(). Snowflake::from_json then falls through to
get_to(uint64_t) on a null and throws type_error.302.
same JS_O issue as the channel's one, same optional<Snowflake> target.
@ouwou
ouwou merged commit 7b3a4ff into uowuo:master Sep 9, 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.

2 participants