Skip to content

fix: handle None data in skill_processor._parse_skill()#405

Merged
qin-ctx merged 1 commit intovolcengine:mainfrom
r266-tech:fix/skill-processor-none-data
Mar 4, 2026
Merged

fix: handle None data in skill_processor._parse_skill()#405
qin-ctx merged 1 commit intovolcengine:mainfrom
r266-tech:fix/skill-processor-none-data

Conversation

@r266-tech
Copy link
Contributor

Problem

_parse_skill() raises ValueError: Unsupported data type: <class 'NoneType'> when data is None. This causes confusing 500 errors on the /api/v1/skills endpoint when called with empty/null data.

The None value falls through all isinstance checks and hits the generic else branch, producing an unhelpful error message.

Fix

Add an explicit None guard at the beginning of both:

  • process_skill() (public API, defense in depth)
  • _parse_skill() (where the actual parsing happens)

Both raise ValueError("Skill data cannot be None") with a clear, actionable message.

Tests

Added tests/unit/test_skill_processor_none.py with 4 tests:

  • test_parse_skill_none_raises_value_error — None raises ValueError with explicit message
  • test_parse_skill_none_not_unsupported_type — error message is NOT the generic one
  • test_parse_skill_valid_dict_passes — valid dict input still works
  • test_parse_skill_unsupported_type_still_raises — other invalid types still get the generic error

All tests pass.

Add explicit None guard in both process_skill() and _parse_skill() to
raise a clear ValueError("Skill data cannot be None") instead of falling
through to the generic "Unsupported data type: <class 'NoneType'>"
error. This prevents confusing 500 errors on /api/v1/skills when called
with empty/null data.

Also adds unit tests for the None handling.
@qin-ctx qin-ctx merged commit ecc780d into volcengine:main Mar 4, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants