Skip to content

Add OumiConfigParsingError covering all OmegaConf exceptions#2323

Open
idoudali wants to merge 2 commits intoidoudali/config-exceptionsfrom
idoudali/ope-1852-generate-error-message-on-omega-generated-configkeyerror
Open

Add OumiConfigParsingError covering all OmegaConf exceptions#2323
idoudali wants to merge 2 commits intoidoudali/config-exceptionsfrom
idoudali/ope-1852-generate-error-message-on-omega-generated-configkeyerror

Conversation

@idoudali
Copy link
Copy Markdown
Contributor

Description

Introduce OumiConfigParsingError to wrap all OmegaConfBaseException subclasses (ValidationError, GrammarParseError, ConfigIndexError, etc.) so that every OmegaConf exception is reported as a clean user-facing error by the CLI instead of dumping a full traceback.

  • exceptions.py: new OumiConfigParsingError with msg/full_key extraction
  • base_config.py: 5 catch sites updated (from_yaml, from_str, from_yaml_and_arg_list)
  • verl_grpo_trainer.py: catch site updated
  • test_base_config.py: updated existing ConfigKeyError test, added GrammarParseError test
  • test_config.py: two ValidationError tests now expect OumiConfigParsingError with cause chain

Fixes OPE-1852

Related issues

Fixes # (issue)

Before submitting

  • This PR only changes documentation. (You can ignore the following checks in that case)
  • Did you read the contributor guideline Pull Request guidelines?
  • Did you link the issue(s) related to this PR in the section above?
  • Did you add / update tests where needed?

Reviewers

At least one review from a member of oumi-ai/oumi-staff is required.

…rror handling

Introduce dedicated config exception types and add explicit
configuration checks to catch invalid or missing values early. Wire
these failures into the CLI global handler so users get clearer,
consistent error messages. Improve current file checks during
configuration parsing.

Fixes OPE-1848
@idoudali idoudali self-assigned this Mar 27, 2026
Introduce OumiConfigParsingError to wrap all OmegaConfBaseException subclasses
(ValidationError, GrammarParseError, ConfigIndexError, etc.) so that every
OmegaConf exception raised in our configs submodule is reported as a clean
user-facing error by the CLI instead of dumping a full traceback.

Fixes OPE-1852
@idoudali idoudali force-pushed the idoudali/ope-1852-generate-error-message-on-omega-generated-configkeyerror branch from a306a1f to 6cc8433 Compare March 28, 2026 09:55
@idoudali idoudali marked this pull request as ready for review March 28, 2026 09:55
Copilot AI review requested due to automatic review settings March 28, 2026 09:55
@idoudali idoudali requested a review from oelachqar March 28, 2026 09:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a dedicated OumiConfigParsingError to wrap OmegaConf parsing/validation exceptions so CLI/config loading surfaces clean, user-facing configuration errors (via OumiConfigError) rather than raw OmegaConf tracebacks.

Changes:

  • Added OumiConfigParsingError (and OumiConfigTypeError) to the central exception hierarchy in src/oumi/exceptions.py.
  • Updated BaseConfig.from_yaml(), from_str(), and from_yaml_and_arg_list() to catch OmegaConfBaseException and re-raise as OumiConfigParsingError with proper __cause__ chaining; replaced ad-hoc TypeError with OumiConfigTypeError.
  • Updated/added unit tests to assert the new wrapper exception behavior and cause chaining (including a malformed interpolation case).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/unit/core/configs/test_config.py Updates expectations to OumiConfigParsingError and asserts underlying OmegaConf cause is chained.
tests/unit/core/configs/test_base_config.py Adds coverage for wrapped parsing errors (unknown field + malformed interpolation) and reuses a shared YAML fixture string.
src/oumi/exceptions.py Adds OumiConfigParsingError (and OumiConfigTypeError) to support consistent, user-friendly config error handling.
src/oumi/core/configs/base_config.py Wraps OmegaConf exceptions during YAML/string load and CLI arg merges into OumiConfigParsingError, and standardizes type mismatch errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@idoudali idoudali force-pushed the idoudali/config-exceptions branch 3 times, most recently from e46d02e to 4804801 Compare April 17, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants