thread.members._add is not a function
Currently on v14.15.3, nodejs v21.7.1
I don't actually do anything with threads or thread members so it seems specificaly related to the message handler from a thread, possibly mentioning the bot?
85 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!not yet but i'm trying to see if i can figure out which server it's happening on
just got a different stack trace, still trying to identify where it's coming from
it's very odd it just started happening today after i updated from 14.15.2 to 14.15.3 but i dont think that would be related. it's only happening on one shard so i think it must be only one server it's happening on
nope just straight from npm/yarn
i'm going to modify that file in prod to log
thread
and thread.members
to see if i can figure out whats going on. like you said it might be some weird partial
ok, i found the server 755765126140919881
so i can at least investigate it moreok that's weird...
that's a guild text channel
it has no
.name
propertytoo big to paste, here's the channel
Why is it using camel case?
Is <#1248260941884162151> actually a text channel, or a thread?
how can i verify that with code?
let me see if i can get the full printout
Looks like it's a thread, but why the type is 0
it's consistent even after restarts
What's type of 1094658972004397127?
15
and i'm receiving like those thread member updates obviously for that channel, but i guess because it's type 0, it never got initialized as a thread channel
well i'm wondering if the initial gateway is sending it as type 0, because even when i force fetch it, still returns 0
I don’t think force fetching it would fix the channel type
Or ig if you do it via the manager
It is ^
dont think so 😄 it's literally just this one channel
ok lads, even though i restarted multiple times, i just pushed out a new docker image with that raw log and now it's type 11 😕
so i think we blame discord and call it a wrap
ok. it's back again but on a different channel/shard completely. i have no idea what's going on.
i do but i havent seen anything like that before and no sir, i dont do anything like that
across all the channels in my cache, there are 363891 in total, so i find it very odd that it just started randomly happening today and it's only one particular channel, even "fixed" after and started randomly happening to a different one
I'll reach out and see what they say! Thanks
Also having this issue
Only on launch
Yeah it's still happening to me but I'm just ignoring it for now
@A Floofy Fluffy Vladdy banned
Discord api server post https://discord.com/channels/613425648685547541/1250430249171419248 I probably need to bump it
Sorry for the delayed reply. So I added a try/catch in
ThreadMembersUpdate.js
to log which id was causing issues, then i updated the client to log the raw
event below:
BROKEN THREAD CHANNEL ID: 1262397367458594816Bad thread just once, only on the thread
raw.d.threads
heres the whole thing from when i first logged the channel ID after it happened to updating the raw handler and restarting the bot:
That shouldn't happen, we only ever do type magic for text<->announcement
:myDudes:
Channel update is the only place we may alter types to my knowledge
cc @PKASH cuz you also get this error
@Xabi
:monkaHmmm:
sorry, i misunderstood the assignment. here is another channel it just happened to(had to paste as file):
/app/node_modules/discord.js/src/client/actions/ThreadMembersUpdate.js
client.js
the log for the channel update has not fired yet, but this is what i put:
sorry i had truncated it, i fixed it
i chain the .on
calls so was just trying to fix it
lol
i understand what you're saying, but i've been pretty forthcoming with everything i have. if you no longer want to help then that's fine
it's not a blocking issue for me, i just thought i would report an issue that arose semi-recently. it seems a couple of other people are having this issue. not sure
@PKASH @Xabi do you use partials?@NotDemonix
A
We got some partials, let me send the list
Message, channel, user and guild member
gotcha. i also have channel partial. i have ThreadMember as well but it seems more channel related than member related. wonder if it's a partial for whatever reason and defaulting to the wrong type and not updating after a channel update
I can't really test removing the channel partial since it will probably miss some channelDelete events causing extra issues
wait
am I seeing it right that you got a broken thread id for a channel that was somehow stored as a text channel
correct. i am receiving ThreadMembersUpdate events but the channel is stored as a TextChannel
can you do a raw api request for me?
but we know from doing the rest calls it's a type 11
thats..what i was gonna ask for :KEKW:
wtf
https://discord.com/channels/222078108977594368/1248260322163294238/1248282260143079516
whats super weird is that it "changes". like if i restart the gateway, it'll be received as a type 11 but then a random other thread will start throwing that same error
the only way this is possible is if somehow discord sends us this channel in guild_create or thread_list_sync as text
is it not always the same id?
nope. like that example i sent, that's a type 11 in my cache right now. but i have another ID that is "currently" happening
i don't even really do much with threads with my bot. i only started using the Channel partial just because i listen for message events for specific automation and it was missing threads until i added channel partials
and the current thread thats throwing the errors, if you have an eval cmd, can you log cache.get(id).partial?
sure give me a sec, it's on a different shard
i need to find the channel_id because it doesnt log it, just the unhandled rejection
i thought your patch logged it
separate process, not the same node_modules folder
a h
i'll post in here when it happens again. just have to wait unfortunately because i dont have a way to programmatically find which channels it happens to
however i was curious about this line:
https://github.com/discordjs/discord.js/blob/efa16a6095e012ff4d138b21d128df5f407fc93c/packages/discord.js/src/structures/BaseChannel.js#L80
i vaguely recall somewhere that you needed channel partial not only for DMs, but also for messages in threads that the bot was not actively a part of yet. is that true?
i can confirm the first part of your question, got no clue about the second part
i'd have to dig into the code eventually and check
gotcha. it says that all ThreadChannels just inherit from
BaseChannel.partial
, so i guess it will always return false
https://discord.com/channels/222078108977594368/1148749662078119976/1148766030412382301
this is the logged patch that logs the ID in ThreadMembersUpdate.js
logging .partial
returns false, but i think it's always going to be false according to the librarywhats real real weird
is that its a text channel instance but has memberCount
and tmk thats thread only
ahhh that is super helpful actually!!
Oh my
I'll need to double check I'm not high but that doesn't look right
there are type 11 channels with memberCount too, so it's not all or nothing
That's...concerning then
Keep in mind the debug log is spammy as hell
Might wanna filter out to only messages matching the header
Yes (GuildMember, Reaction, Channel, Message)
Sounds good. I'll pull it down and run it shortly. Thanks for looking into this!!
ok getting a lot of logs lol
it's still going but they all look more or less like the above
here's the full with the console.trace i forgot to add
i also saw one for type 7 which isn't documented too
here's the type 7:
THAT LOOKS LIKE A USER NO?
caps
nvm
wrap had me trippin
let me see if i can pull it
interestingly, when i do channels.cache.get().type, it's 0
so that would probably help explain the whole 0 thing
it's a "new-members" channel in some gaming guild
hmm... i dont see it in the logs. i checked my logs that i send to a db and my file system logs just to be sure
:shrug:
we just ignore types we dont support
it's not like a pressing issue, the bot functions normally, just those unhandled rejections i receive
yeah it is a gaming guild so that makes sense
nothing on 19/20 unfortunately
holy shit LFG channels still exist??
flags: 10, so it's a media channel?
so i guess the followup question is, why is it i can get the channel from the cache and it returns type 0?
if they're supposed to be ignored
partials maybe?
everyone having the issue does have the channel partial
would also explain the undefined type
19652 [7/16/2024, 3:30:59 PM] [TRACE] [DebugHandler] [THREAD-TEXT]: Received non-text channel type undefined
19653 [7/16/2024, 3:30:59 PM] [TRACE] [DebugHandler] {"id":"1147244500452905160","channel_id":"1147244500452905160","guild_id":"1147013203423928390","recipients":[{}]}
calling cache get returns type 0 on this as well
thats...
wait
that looks like a partial object from us
ah it explains why this started failing semirecently, so it was 2-3 months ago that it was checked in
this was a clutch catch
will do
thank you all for your help and patience!! and thank you @Jiralite for the quick logging change. i'm around to test any potential fixes if you need me to
i could tell from the
recipients: [{}]
LMAOsent a bug bounty to your opencollective! cheers 🎉
@Jiralite do you want me to make an issue on github for tracking?
Iv'e gotten several of these in the past few days not sure if it's related to this issue as well
same line as mine, just a different part. that's interesting though that it's different for you
I'm not sure if my issue is also related to this, but i have been getting similar error myself too
Like
Happens when using slash commands
At first, I thought maybe it was because the command was used in an uncached channel (as an user app), but looking at the source here
https://github.com/discordjs/discord.js/blob/main/packages%2Fdiscord.js%2Fsrc%2Fstructures%2FWebhook.js#L232, the optional chaining (?) should short circuit, also it's actually
messages
property that's undefined, which confuses me. Because from my understanding, the channel returned shoukd be a TextChannel
since slash commands can only be used in those (right ?). So I have no idea what channel type it's getting there. I tried to reproduce this multiple times myself with no avail, it only happens sometimes rarely
will do thatIs it possible the command is being run in a group DM via user apps (maybe you registered it directly with the API instead of using d.js)?
oh yeah you did say it's a user app
Yes group dm was the issue, which we discussed on a different thread
The issue is being tracked with the user app pr
ah