What Red version are you using?
3.5.25.dev1 (V3/develop @ 61484f2)
What were you trying to do?
Restore third-party cogs from a Red backup with redbot-setup restore. I audited the failure reporting in redbot.core._downloader._restore_from_backup() because these messages are the only diagnostic output when a cog cannot be restored.
What did you expect to happen?
Every restore failure should produce a normal log record containing the cog name, repository name, and failed shared-library names. Logging a recovery failure must not itself raise a formatting exception.
What actually happened?
Three log calls in the restore path have missing format arguments.
- Lines 989 and 994 log
The commit that %r cog... without passing cog.name, so the literal placeholder is printed instead of the affected cog.
- The
failed_libs branch at lines 1066-1069 has three placeholders but passes only two arguments. Python logging raises TypeError: not enough arguments for format string, and the intended failure message is lost.
Observed output:
WARNING:The commit that %r cog was installed from is unknown ...
ERROR:The commit that %r cog was installed from is unknown ...
--- Logging error ---
TypeError: not enough arguments for format string
Message: 'Failed to reinstall shared libraries for %r cog from %r repo: %s'
Arguments: ('repo-name', 'lib-name')
How can we reproduce this error?
- Check out
V3/develop at 61484f28f7fcfff81309cb2b0b0d5287c921f1ad and install the test dependencies on Python 3.11.
- Attach a
logging.StreamHandler to red.core.downloader.
- Exercise the two no-commit branches in
_restore_from_backup(); both records retain a literal %r.
- Return a
CogInstallResult with a non-empty failed_libs tuple from install_cogs().
- Observe the logging traceback above instead of the intended cog/repository/library diagnostic.
The same failure can be isolated with the production format string:
log.error(
'Failed to reinstall shared libraries for %r cog from %r repo: %s',
'repo-name',
'lib-name',
)
Anything else?
Environment: Debian Bookworm arm64 container, Python 3.11.15. The unmodified baseline passes 313 passed, 7 skipped; pylint --errors-only redbot independently reports E1206 at line 1066. I searched open and closed issues for the exact messages, backup restore logging errors, failed shared libraries, and missing commit metadata; no duplicate was found.
Likely minimal fix: pass cog.name to both missing-commit messages, and pass cog.name, cog.repo.name, then the joined library names to the failed-libraries message. I will add regression coverage for all three formatted records separately.
What Red version are you using?
3.5.25.dev1 (V3/develop @ 61484f2)
What were you trying to do?
Restore third-party cogs from a Red backup with
redbot-setup restore. I audited the failure reporting inredbot.core._downloader._restore_from_backup()because these messages are the only diagnostic output when a cog cannot be restored.What did you expect to happen?
Every restore failure should produce a normal log record containing the cog name, repository name, and failed shared-library names. Logging a recovery failure must not itself raise a formatting exception.
What actually happened?
Three log calls in the restore path have missing format arguments.
The commit that %r cog...without passingcog.name, so the literal placeholder is printed instead of the affected cog.failed_libsbranch at lines 1066-1069 has three placeholders but passes only two arguments. Python logging raisesTypeError: not enough arguments for format string, and the intended failure message is lost.Observed output:
How can we reproduce this error?
V3/developat61484f28f7fcfff81309cb2b0b0d5287c921f1adand install the test dependencies on Python 3.11.logging.StreamHandlertored.core.downloader._restore_from_backup(); both records retain a literal%r.CogInstallResultwith a non-emptyfailed_libstuple frominstall_cogs().The same failure can be isolated with the production format string:
Anything else?
Environment: Debian Bookworm arm64 container, Python 3.11.15. The unmodified baseline passes
313 passed, 7 skipped;pylint --errors-only redbotindependently reports E1206 at line 1066. I searched open and closed issues for the exact messages, backup restore logging errors, failed shared libraries, and missing commit metadata; no duplicate was found.Likely minimal fix: pass
cog.nameto both missing-commit messages, and passcog.name,cog.repo.name, then the joined library names to the failed-libraries message. I will add regression coverage for all three formatted records separately.