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

Parent channel of thread has no thread manager #10563

Open
Glazelf opened this issue Oct 17, 2024 · 13 comments
Open

Parent channel of thread has no thread manager #10563

Glazelf opened this issue Oct 17, 2024 · 13 comments

Comments

@Glazelf
Copy link

Glazelf commented Oct 17, 2024

Which package is this bug report for?

discord.js

Issue description

Bot "randomly" (not during boot cycle) crashes with error below:
Schermafbeelding 2024-10-17 130011

Seems to be an issue with thread parent checks or something. I talked to @almostSouji about this problem here, for some context.

Note (souji):
The issue is not reproduceable on reboot and happened only once during normal operation.

Code sample

No response

Versions

  • discord.js 14.16.3

Issue priority

Low (slightly annoying)

Which partials do you have configured?

User, Channel, GuildMember, Message, Reaction

Which gateway intents are you subscribing to?

Guilds, GuildMembers, GuildModeration, GuildMessages, GuildMessageReactions, DirectMessages, MessageContent

I have tested this issue on a development release

No response

@almostSouji
Copy link
Member

almostSouji commented Oct 17, 2024

Seems to come from here:

case ChannelType.AnnouncementThread:
case ChannelType.PublicThread:
case ChannelType.PrivateThread: {
channel = new (getThreadChannel())(guild, data, client);
if (!allowUnknownGuild) channel.parent?.threads.cache.set(channel.id, channel);
break;

Which would imply a channel that does not have .threads (or another value) is being set as a parent (since the .parent seems to exist) at some point in time.

Potential causes could be a corrupted cache or a private thread being created on a somewhat rare channel type, which we have not considered yet.

@almostSouji
Copy link
Member

Looking at the partials, could this potentially be caused by the parent being partial?
So we receive the partial parent and populate the cache with it; then the thread is being constructed and the partial parent does not have the .threads?

@almostSouji almostSouji changed the title Thread parent check Parent channel of private thread has no thread manager Oct 17, 2024
@almostSouji almostSouji changed the title Parent channel of private thread has no thread manager Parent channel of thread has no thread manager Oct 17, 2024
@Glazelf
Copy link
Author

Glazelf commented Jan 5, 2025

Encountered this a second time earlier today. Error below, on D.JS 14.17.2.
chrome_g16Jna4TAn

@Jiralite
Copy link
Member

Jiralite commented Jan 5, 2025

Do me a favour and install 14.17.3-dev.1736101599-df68b469f. I added some debug logs regarding as soon as you receive incoming data and what happens right before that crash. It's running 14.17.2 with these changes: v14...14.7.2-1.

Listen to debug logs like so:

import { Events } from "discord.js";

client.on(Events.Debug, (message) => {
	// Optionally filter for the specific debug logs.
	// if (!message.startsWith("[14.7.2 DEBUG]")) return;
	console.log(message);
});

Yes, it does say 14.7.2 instead of 14.17.2, but don't worry about that! It's just a string.

I'm curious to see what the incoming data is, and what it eventually resolved to, as well as what parent actually is, etc. Might help point us in the right direction, especially if this is not reproducible.

@Glazelf
Copy link
Author

Glazelf commented Jan 5, 2025

Installed the version you specified, bot crashes on boot with the following error:
image

@Jiralite
Copy link
Member

Jiralite commented Jan 5, 2025

Well then. That sounds like a bug in itself... hold off on that, I guess (or implement the changes yourself, if you know how to patch versions).

@Glazelf
Copy link
Author

Glazelf commented Jan 5, 2025

Haha I have no idea. But this is a bug with djs then right, not with my codebase?
Hope this helps someone more wellread into the djs codebase fix this, then! :)

@Jiralite
Copy link
Member

Jiralite commented Jan 5, 2025

Haha I have no idea. But this is a bug with djs then right, not with my codebase?

Cannot answer that without knowing what's going on first.

Try using 14.17.3-dev.1736104404-15cbca941... should not get that error any more.

@Glazelf
Copy link
Author

Glazelf commented Jan 5, 2025

14.17.3-dev.1736104404-15cbca941 boots succesfully and does not seem to produce any errors from what I can tell.
Though as said I couldn't really seem to repro the crash on-demand so I don't know if that is fixed.

@Jiralite
Copy link
Member

Jiralite commented Jan 5, 2025

Listen to the debug event and when you crash, share the logs!

@Glazelf
Copy link
Author

Glazelf commented Jan 5, 2025

Will do, however I did go 3 months without encountering this error before today so I'm not sure how long that will take :P

@Glazelf
Copy link
Author

Glazelf commented Jan 8, 2025

Hi Jiralite, are the changes you made for 14.17.3-dev.1736104404-15cbca941 also included in the stable 14.17.3 release?

@Jiralite
Copy link
Member

Jiralite commented Jan 8, 2025

No. Anyway, The patches in 14.17.3 are already in 14.17.3-dev.1736104404-15cbca941, so you're not missing anything.

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

No branches or pull requests

3 participants