JDA icon indicating copy to clipboard operation
JDA copied to clipboard

ThreadChannel#retrieveMembers throwing ParsingException

Open oliver276 opened this issue 3 years ago • 5 comments

General Troubleshooting

  • [x] I have checked for similar issues.
  • [x] I have updated to the latest JDA version.
  • [x] I have checked the branches or the maintainers' PRs for upcoming bug fixes.

Bug Report

ThreadChannel#retrieveThreadMembers does not work.

This method depends on the EntityBuilder being able to construct a ThreadMember using the member field in the json payload response, but this is not given. JSON response from Discord:

[
    {
        "id": "930264297064517663",
        "flags": 0,
        "join_timestamp": "2022-01-11T00:58:12+00:00",
        "user_id": "187979032904728576"
    },
    {
        "id": "930264297064517663",
        "flags": 1,
        "join_timestamp": "2022-01-11T03:11:27.366000+00:00",
        "muted": false,
        "mute_config": null,
        "user_id": "381877390219018250"
    }
]

Expected Behavior

ThreadMembers are built using the JSON provided.

Code Example or Reproduction Steps

ThreadChannel#retrieveThreadMembers().queue()

Code for JDABuilder or DefaultShardManagerBuilder Used

N/A

Exception or Error

[JDA RateLimit-Worker 2] ERROR Requester - There was an unexpected error while executing a REST request
net.dv8tion.jda.api.exceptions.ParsingException: Unable to resolve value with key member to type DataObject: null
	at net.dv8tion.jda.api.utils.data.DataObject.valueError(DataObject.java:807)
	at net.dv8tion.jda.api.utils.data.DataObject.lambda$getObject$0(DataObject.java:277)
	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
	at net.dv8tion.jda.api.utils.data.DataObject.getObject(DataObject.java:277)
	at net.dv8tion.jda.internal.entities.EntityBuilder.createThreadMember(EntityBuilder.java:1210)
	at net.dv8tion.jda.internal.entities.ThreadChannelImpl.lambda$retrieveThreadMembers$3(ThreadChannelImpl.java:172)
	at net.dv8tion.jda.internal.requests.RestActionImpl.handleSuccess(RestActionImpl.java:278)
	at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:268)
	at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:259)
	at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:237)
	at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:141)
	at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:124)
	at net.dv8tion.jda.internal.requests.ratelimit.BotRateLimiter$Bucket.run(BotRateLimiter.java:478)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
[ForkJoinPool.commonPool-worker-19] ERROR RestAction - RestAction queue returned failure: [ErrorResponseException] -1: net.dv8tion.jda.api.exceptions.ParsingException
net.dv8tion.jda.api.exceptions.ParsingException: Unable to resolve value with key member to type DataObject: null
	at net.dv8tion.jda.api.utils.data.DataObject.valueError(DataObject.java:807)
	at net.dv8tion.jda.api.utils.data.DataObject.lambda$getObject$0(DataObject.java:277)
	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
	at net.dv8tion.jda.api.utils.data.DataObject.getObject(DataObject.java:277)
	at net.dv8tion.jda.internal.entities.EntityBuilder.createThreadMember(EntityBuilder.java:1210)
	at net.dv8tion.jda.internal.entities.ThreadChannelImpl.lambda$retrieveThreadMembers$3(ThreadChannelImpl.java:172)
	at net.dv8tion.jda.internal.requests.RestActionImpl.handleSuccess(RestActionImpl.java:278)
	at net.dv8tion.jda.internal.requests.RestActionImpl.handleResponse(RestActionImpl.java:268)
	at net.dv8tion.jda.api.requests.Request.handleResponse(Request.java:259)
	at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:237)
	at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:141)
	at net.dv8tion.jda.internal.requests.Requester.execute(Requester.java:124)
	at net.dv8tion.jda.internal.requests.ratelimit.BotRateLimiter$Bucket.run(BotRateLimiter.java:478)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: net.dv8tion.jda.api.exceptions.ContextException
Caused by: net.dv8tion.jda.api.exceptions.ContextException

	at net.dv8tion.jda.api.exceptions.ContextException.here(ContextException.java:54)
	at net.dv8tion.jda.api.requests.Request.<init>(Request.java:71)
	at net.dv8tion.jda.internal.requests.RestActionImpl.queue(RestActionImpl.java:197)
	at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:573)
	at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:539)
	at net.dv8tion.jda.api.requests.RestAction$queue.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
	at Bot.onMessageReceived(Bot.groovy:45)
	at net.dv8tion.jda.api.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:358)
	at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handleInternally(EventManagerProxy.java:88)
	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:70)
	at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:163)
	at net.dv8tion.jda.internal.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:111)
	at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:36)
	at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:953)
	at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:840)
	at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:818)
	at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:992)
	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)

oliver276 avatar Jan 16 '22 22:01 oliver276

This likely means that we're going to have to make ThreadMember.getMember() nullable unless we can get Discord to provide this information

DV8FromTheWorld avatar Jan 19 '22 20:01 DV8FromTheWorld

Had a lengthy conversation with @ajpalkovic about this issue. The conclusion is that, given bandwidth, Discord will add .member on the ThreadMember entities returned by this endpoint.

Not sure what the timetable for that looks like though

DV8FromTheWorld avatar Feb 03 '22 20:02 DV8FromTheWorld

Whats the status on this?

MinnDevelopment avatar May 20 '22 14:05 MinnDevelopment

The JSON I get back from the API is still the same, I think we're waiting on Discord's change.

oliver276 avatar May 20 '22 15:05 oliver276

@ajpalkovic has changes in a branch for this iirc. I'll sync with him on it.

DV8FromTheWorld avatar May 23 '22 16:05 DV8FromTheWorld

@DV8FromTheWorld I'd assume this has been resolved since?

Tais993 avatar Oct 10 '22 12:10 Tais993