Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException/Failed to parse JSON #2641

Closed
2 tasks done
alvin0319 opened this issue Apr 4, 2024 · 5 comments
Closed
2 tasks done

ClassCastException/Failed to parse JSON #2641

alvin0319 opened this issue Apr 4, 2024 · 5 comments
Labels

Comments

@alvin0319
Copy link

alvin0319 commented Apr 4, 2024

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have checked for PRs that might already address this issue.

Version of JDA

5.0.0-beta.21_711e4e7

Expected Behaviour

JDA should be able to parse packets from discord.

This has started happening from yesterday, and I'm constantly getting this error approximately every 30/40 minutes.

Code Example for Reproduction Steps

N/A

Code for JDABuilder or DefaultShardManagerBuilder used

val shardManager = DefaultShardManagerBuilder.createDefault(config.token)
        .injectKTX()
        .enableIntents(
            GatewayIntent.GUILD_EMOJIS_AND_STICKERS,
            GatewayIntent.MESSAGE_CONTENT,
            GatewayIntent.GUILD_VOICE_STATES
        )
        .enableCache(CacheFlag.EMOJI, CacheFlag.VOICE_STATE)
        .setGatewayEncoding(GatewayEncoding.ETF)
        .setAutoReconnect(true)
        .setAudioPool(
            Executors.newScheduledThreadPool(
                maxVirtualThreadPoolSize,
                Thread.ofVirtual().name("JDA-AudioPool-Thread-", 0).factory()
            )
        )
        .setRateLimitScheduler(
            Executors.newScheduledThreadPool(
                maxVirtualThreadPoolSize,
                Thread.ofVirtual().name("JDA-RateLimit-Thread-", 0).factory()
            )
        )
        .setEventPool(
            Executors.newThreadPerTaskExecutor(Thread.ofVirtual().name("JDA-Event-Thread-", 0).factory()),
            true
        )
        .setCallbackPool(
            Executors.newCachedThreadPool {
                Thread(it, "CallbackPool")
            },
            true
        )
        .setMemberCachePolicy(MemberCachePolicy.VOICE)
        .setHttpClientBuilder(Constant.OKHTTP_CLIENT_BUILDER)
        .setHttpClient(Constant.OKHTTP_CLIENT_BUILDER.build())
        .setLargeThreshold(50)
        .build()

Exception or Error

java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpackMap0(ExTermDecoder.java:281)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpack0(ExTermDecoder.java:151)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpackMap0(ExTermDecoder.java:282)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpack0(ExTermDecoder.java:151)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpackMap0(ExTermDecoder.java:282)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpack0(ExTermDecoder.java:151)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpackList0(ExTermDecoder.java:267)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpack0(ExTermDecoder.java:152)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpackMap0(ExTermDecoder.java:282)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpack0(ExTermDecoder.java:151)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpackMap0(ExTermDecoder.java:282)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpack0(ExTermDecoder.java:151)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpack(ExTermDecoder.java:68)
    at net.dv8tion.jda.api.utils.data.etf.ExTermDecoder.unpackMap(ExTermDecoder.java:99)
    at net.dv8tion.jda.api.utils.data.DataObject.fromETF(DataObject.java:212)
    at net.dv8tion.jda.internal.requests.WebSocketClient.handleBinary(WebSocketClient.java:1074)
    at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1043)
    at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
    at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
    at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
    at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
    at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
@freya022
Copy link
Contributor

freya022 commented Apr 4, 2024

Try switching back from ETF to JSON in the meantime

@duncte123
Copy link
Contributor

Chiming in with my own stack trace as well
https://duncte123.sentry.io/share/issue/e40991ef3ef94b99938dd5773b30a7c7/

builder config

@MinnDevelopment MinnDevelopment added the status: need more info in need of additional details label Apr 4, 2024
@alvin0319
Copy link
Author

It seems that JSON encoding doesn't have this error, I have running it 4 hours without these error. (although I'm not sure if it is "fixed" on discord side)

@MinnDevelopment MinnDevelopment added bug and removed status: need more info in need of additional details labels Apr 4, 2024
@MinnDevelopment
Copy link
Member

This should be fixed by #2642

@MinnDevelopment
Copy link
Member

Fixed in 5.0.0-beta.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants