Skip to content

[BUG]: ExtensionAlreadyLoaded error when the bot internally restarting. #3171

@Jerrie-Aries

Description

@Jerrie-Aries

Bot Version

v4.0.0-dev16

How are you hosting Modmail?

Other

Error Logs

See below.

Screenshots

No response

Additional Information

Per title, this error is raised when the bot restarting/reconnecting internally.

Error:

2022-07-12 07:07:47 cogs.utility[639] - DEBUG: Resetting presence.
2022-07-12 07:10:46 core.clients[522] - DEBUG: Successfully connected to the database.
2022-07-12 07:10:46 core.clients[523] - DEBUG: -------------------------
2022-07-12 07:10:46 __main__[521] - DEBUG: Connected to gateway.
2022-07-12 07:10:46 core.clients[478] - DEBUG: Successfully configured and verified database indexes.
2022-07-12 07:10:46 __main__[160] - DEBUG: Loading cogs.modmail.
2022-07-12 07:10:46 __main__[165] - ERROR: Failed to load cogs.modmail.
Traceback (most recent call last):
  File "/Users/Projects/Modmail/bot.py", line 162, in load_extensions
    await self.load_extension(cog)
  File "/Users/Projects/Modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 989, in load_extension
    raise errors.ExtensionAlreadyLoaded(name)
discord.ext.commands.errors.ExtensionAlreadyLoaded: Extension 'cogs.modmail' is already loaded.
2022-07-12 07:10:46 __main__[160] - DEBUG: Loading cogs.plugins.
2022-07-12 07:10:46 __main__[165] - ERROR: Failed to load cogs.plugins.
Traceback (most recent call last):
  File "/Users/Projects/Modmail/bot.py", line 162, in load_extensions
    await self.load_extension(cog)
  File "/Users/Projects/Modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 989, in load_extension
    raise errors.ExtensionAlreadyLoaded(name)
discord.ext.commands.errors.ExtensionAlreadyLoaded: Extension 'cogs.plugins' is already loaded.
2022-07-12 07:10:46 __main__[160] - DEBUG: Loading cogs.utility.
2022-07-12 07:10:46 __main__[165] - ERROR: Failed to load cogs.utility.
Traceback (most recent call last):
  File "/Users/Projects/Modmail/bot.py", line 162, in load_extensions
    await self.load_extension(cog)
  File "/Users/Projects/Modmail/.venv/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 989, in load_extension
    raise errors.ExtensionAlreadyLoaded(name)
discord.ext.commands.errors.ExtensionAlreadyLoaded: Extension 'cogs.utility' is already loaded.
2022-07-12 07:10:46 __main__[166] - DEBUG: -------------------------
2022-07-12 07:10:48 __main__[539] - INFO: -------------------------
2022-07-12 07:10:48 __main__[540] - WARNING: Bot restarted due to internal discord reloading.
2022-07-12 07:10:48 __main__[541] - INFO: -------------------------

Not sure whether this should be handled or left out as is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    maybe: bugAn unconfirmed bugstagedStaged for next version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions