Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(conf): add cause to re-raised value-error to keep context. (#9940)

Carlos Freund29fe91182816
diff --git a/openhands/core/config/utils.py b/openhands/core/config/utils.py
index 9870204ae7..7f5c9b8b46 100644
--- a/openhands/core/config/utils.py
+++ b/openhands/core/config/utils.py
@@ -224,9 +224,9 @@ def load_from_toml(cfg: OpenHandsConfig, toml_file: str = 'config.toml') -> None
logger.openhands_logger.warning(
f'Cannot parse [sandbox] config from toml, values have not been applied.\nError: {e}'
)
- except ValueError:
+ except ValueError as e:
# Re-raise ValueError from SandboxConfig.from_toml_section
- raise ValueError('Error in [sandbox] section in config.toml')
+ raise ValueError('Error in [sandbox] section in config.toml') from e
# Process MCP sections if present
if 'mcp' in toml_config: