Skip to content

badger doctor --reset creates invalid config files, causes badger to crash #255

Description

@nstelter-slac

seen on my local linux machine.

badger doctor --reset creates a bad new config file with entries that look like:

BADGER_ARCHIVE_ROOT:
  description: This setting (BADGER_ARCHIVE_ROOT) tells Badger where to archive the
    historical optimization runs
  display_name: archive root
  is_path: true
  value:
    description: This setting (BADGER_ARCHIVE_ROOT) tells Badger where to archive
      the historical optimization runs
    display_name: archive root
    is_path: true
    value: null

the issue here is that the value section should just be a single value (directory path in this case), but instead has all of the following:

  value:
    description: This setting (BADGER_ARCHIVE_ROOT) tells Badger where to archive
      the historical optimization runs
    display_name: archive root
    is_path: true
    value: null

this causes badger to crash on launch with the following error:

Traceback (most recent call last):
  File "/home/nolan/miniforge3/envs/badger-env/bin/badger", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/nolan/repos/Badger/src/badger/__main__.py", line 139, in main
    setup_logging(args)
  File "/home/nolan/repos/Badger/src/badger/log.py", line 252, in setup_logging
    config_singleton = init_settings(args.config_filepath)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nolan/repos/Badger/src/badger/settings.py", line 434, in init_settings
    config_singleton = ConfigSingleton(file_path, user_flag)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nolan/repos/Badger/src/badger/settings.py", line 134, in __new__
    cls._instance._config = cls.load_or_create_config(config_path)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/nolan/repos/Badger/src/badger/settings.py", line 165, in load_or_create_config
    config_data[key] = Setting(
                       ^^^^^^^^
  File "/home/nolan/miniforge3/envs/badger-env/lib/python3.12/site-packages/pydantic/main.py", line 250, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)

also badger doctor should prob have a testcase, and added to docs and its usage more clear from badger -h

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions