Skip to content

failed to read config file None when DEFAULT_CONFIG_FILE is corrupt #3611

@kurtmckee

Description

@kurtmckee

Issue

When DEFAULT_CONFIG_FILE is corrupted, tox outputs failed to read config file None.

Environment

Provide at least:

  • OS: Linux
Output of pip list of the host Python, where tox is installed
$ pip list
Package       Version                          Editable project location
------------- -------------------------------- -------------------------
cachetools    6.2.0
chardet       5.2.0
colorama      0.4.6
distlib       0.4.0
filelock      3.19.1
packaging     25.0
pip           25.2
platformdirs  4.4.0
pluggy        1.6.0
pyproject-api 1.9.1
setuptools    80.9.0
tox           4.30.3.dev0+g5e0784a7f.d20250917 /home/kurt/dev/pr-tox
virtualenv    20.34.0
wheel         0.45.1

Output of running tox

Output of tox -rvv
$ tox --help
ERROR:root:failed to read config file None because File contains no section headers.
file: '/home/kurt/.config/tox/config.ini', line: 1
'[tox\n'
ROOT: failed to read config file None because File contains no section headers.
file: '/home/kurt/.config/tox/config.ini', line: 1
'[tox\n'
usage: tox [-h] [--colored {yes,no}] [--stderr-color {BLACK,BLUE,CYAN,GREEN,LIGHTBLACK_EX,LIGHTBLUE_EX,LIGHTCYAN_EX,LIGHTGREEN_EX,LIGHTMAGENTA_EX,LIGHTRED_EX,LIGHTWHITE_EX,LIGHTYELLOW_EX,MAGENTA,RED,RESET,WHITE,YELLOW}] [-v | -q]
...

Minimal example

$ echo '[tox' > ~/.config/tox/config.ini

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions