action: from_yaml() doesn't handle yaml.safe_load() exceptions #10540

Open
opened 2026-04-18 17:07:22 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit: Current HEAD
  • Branch: main
  • File: src/cleveragents/action/schema.py
  • Lines: 365-368

Background and Context

The from_yaml() method calls yaml.safe_load() without try-except exception handling. If the YAML is malformed or invalid, a yaml.YAMLError will be raised without a clear error message about YAML parsing failure. This makes debugging difficult for users.

Expected Behavior

The from_yaml() method should catch yaml.YAMLError and other parsing exceptions, and raise a clear, actionable error message that indicates YAML parsing failed and shows the underlying error details.

Acceptance Criteria

  • from_yaml() catches yaml.YAMLError and related exceptions
  • Clear error message indicates YAML parsing failure
  • Error message includes details about the parsing error
  • Existing tests pass with exception handling added
  • New tests verify error handling for malformed YAML

Subtasks

  • Add try-except block around yaml.safe_load() call
  • Catch yaml.YAMLError and other relevant exceptions
  • Create custom exception or raise ValueError with clear message
  • Include original exception details in error message
  • Add test cases for various malformed YAML inputs

Definition of Done

  • from_yaml() handles YAML parsing exceptions gracefully
  • Error messages are clear and actionable
  • All tests pass
  • Code review approved

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit**: Current HEAD - **Branch**: main - **File**: src/cleveragents/action/schema.py - **Lines**: 365-368 ## Background and Context The from_yaml() method calls yaml.safe_load() without try-except exception handling. If the YAML is malformed or invalid, a yaml.YAMLError will be raised without a clear error message about YAML parsing failure. This makes debugging difficult for users. ## Expected Behavior The from_yaml() method should catch yaml.YAMLError and other parsing exceptions, and raise a clear, actionable error message that indicates YAML parsing failed and shows the underlying error details. ## Acceptance Criteria - [ ] from_yaml() catches yaml.YAMLError and related exceptions - [ ] Clear error message indicates YAML parsing failure - [ ] Error message includes details about the parsing error - [ ] Existing tests pass with exception handling added - [ ] New tests verify error handling for malformed YAML ## Subtasks - [ ] Add try-except block around yaml.safe_load() call - [ ] Catch yaml.YAMLError and other relevant exceptions - [ ] Create custom exception or raise ValueError with clear message - [ ] Include original exception details in error message - [ ] Add test cases for various malformed YAML inputs ## Definition of Done - from_yaml() handles YAML parsing exceptions gracefully - Error messages are clear and actionable - All tests pass - Code review approved --- **Automated by CleverAgents Bot** Agent: new-issue-creator
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10540
No description provided.