Skip to content

Fix argument count to --disable-intent log.warning call - #6835

Open
Jackenmen wants to merge 1 commit into
Cog-Creators:V3/developfrom
Jackenmen:fix_log_arg_count
Open

Jackenmen wants to merge 1 commit into
Cog-Creators:V3/developfrom
Jackenmen:fix_log_arg_count

Conversation

@Jackenmen

Copy link
Copy Markdown
Member

Description of the changes

Fix regression introduced by #6828. Also introduced a break since there's point to multiple identical warning messages.

Crash logs for reference:

$ redbot local --disable-intent message_content
[12:44:02] CRITICAL [red.main] The main bot task didn't handle an exception and has crashed
Traceback (most recent call last):
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 488, in red_exception_handler
    red_task.result()
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 340, in run_bot
    log.warning(
  File "/usr/lib/python3.10/logging/__init__.py", line 1489, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/lib/python3.10/logging/__init__.py", line 1624, in _log
    self.handle(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 968, in handle
    self.emit(record)
  File "/home/ubuntu/work/Red-DiscordBot/redbot/logging.py", line 232, in emit
    message = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 678, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.10/logging/__init__.py", line 368, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
           WARNING  [red.main] Attempting to die as gracefully as possible...
           INFO     [red.main] Shutting down from unhandled exception
           INFO     [red.main] Shutting down with exit code: 1 (CRITICAL)
           INFO     [red.main] Please wait, cleaning up a bit more
Traceback (most recent call last):
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 488, in red_exception_handler
    red_task.result()
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 340, in run_bot
    log.warning(
  File "/usr/lib/python3.10/logging/__init__.py", line 1489, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "/usr/lib/python3.10/logging/__init__.py", line 1624, in _log
    self.handle(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 968, in handle
    self.emit(record)
  File "/home/ubuntu/work/Red-DiscordBot/redbot/logging.py", line 232, in emit
    message = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 678, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.10/logging/__init__.py", line 368, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 540, in main
    loop.run_forever()
  File "uvloop/loop.pyx", line 1379, in uvloop.loop.Loop.run_forever
  File "uvloop/loop.pyx", line 557, in uvloop.loop.Loop._run
  File "uvloop/loop.pyx", line 476, in uvloop.loop.Loop._on_idle
  File "uvloop/cbhandles.pyx", line 83, in uvloop.loop.Handle._run
  File "uvloop/cbhandles.pyx", line 63, in uvloop.loop.Handle._run
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 495, in red_exception_handler
    sys.exit(ExitCodes.CRITICAL)
SystemExit: ExitCodes.CRITICAL

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/work/Red-DiscordBot/.venvs/3.10/bin/redbot", line 6, in <module>
    sys.exit(main())
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 558, in main
    loop.run_until_complete(shutdown_handler(red, exc.code))
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/home/ubuntu/work/Red-DiscordBot/redbot/__main__.py", line 459, in shutdown_handler
    await red.close()
  File "/home/ubuntu/work/Red-DiscordBot/redbot/core/bot.py", line 2380, in close
    await super().close()
  File "/home/ubuntu/work/Red-DiscordBot/.venvs/3.10/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 258, in close
    await super().close()  # type: ignore
  File "/home/ubuntu/work/Red-DiscordBot/.venvs/3.10/lib/python3.10/site-packages/discord/shard.py", line 560, in close
    await self._closing_task
  File "/home/ubuntu/work/Red-DiscordBot/.venvs/3.10/lib/python3.10/site-packages/discord/shard.py", line 557, in _close
    self.__queue.put_nowait(EventItem(EventType.clean_close, None, None))
AttributeError: 'Red' object has no attribute '_AutoShardedClient__queue'. Did you mean: '_AutoShardedClient__shards'?

Have the changes in this PR been tested?

Yes

@Jackenmen Jackenmen added this to the 3.5.25 milestone Nov 20, 2026
@Jackenmen Jackenmen added Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing. Release Blocker This needs handling prior to the next non-hotfix release. Changelog Entry: Skipped Changelog entry for this PR is unnecessary. labels Nov 20, 2026
@github-actions github-actions Bot added the Category: Core - Command-line Interfaces This is related to Red's CLIs (redbot, redbot-launcher, redbot-setup). label Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Core - Command-line Interfaces This is related to Red's CLIs (redbot, redbot-launcher, redbot-setup). Changelog Entry: Skipped Changelog entry for this PR is unnecessary. Release Blocker This needs handling prior to the next non-hotfix release. Type: Bug Unexpected behavior, result, or exception. In case of PRs, it is a fix for the foregoing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant