Skip to content

Regression in #12578: pattern argument lost to logger.warning(), causes traceback TypeError: not enough arguments for format string #13295

@abartlet

Description

@abartlet

Describe the bug

Sadly #12578 lost the last argument to logger.warning(), causing difficult to decode error messages, particularity in a parallel build where we get:

  File "/usr/lib/python3.13/multiprocessing/process.py", line 313, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/usr/lib/python3.13/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/sphinx/util/parallel.py", line 83, in _process
    logging.convert_serializable(collector.logs)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/sphinx/util/logging.py", line 88, in convert_serializable
    r.msg = r.getMessage()
            ~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/logging/__init__.py", line 400, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: not enough arguments for format string

The real error is best seen in a single-process build:

full-bt.txt

The key part is:
TypeError: not enough arguments for format string

Message: 'page %s matches two patterns in html_sidebars: %r and %r'
Arguments: ('REDACTED', 'REDACTED')

How to Reproduce

Have a doc/spec/conf.py with a html_sidebars that matches two patterns. The warning blows up the build

Environment Information

Platform:              linux; (Linux-6.8.0-52-generic-x86_64-with-glibc2.40)
Python version:        3.13.1 (main, Feb  1 2025, 21:31:23) [GCC 14.2.0])
Python implementation: CPython
Sphinx version:        8.1.3
Docutils version:      0.21.2
Jinja2 version:        3.1.5
Pygments version:      2.18.0

Sphinx extensions

Additional context

Found on Debian Trixie and Sid as of the time of this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions