Skip to content

fix: return 422 for invalid recall fact types - #3062

Merged
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
tao943:agent/fix-3052-invalid-recall-types
Aug 3, 2026
Merged

fix: return 422 for invalid recall fact types#3062
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
tao943:agent/fix-3052-invalid-recall-types

Conversation

@tao943

@tao943 tao943 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • raise OperationValidationError(status_code=422) for unsupported recall fact types
  • preserve the existing validation detail through the HTTP exception mapping
  • add engine-level and HTTP-level regression coverage

Root cause

MemoryEngine.recall_async raised a plain ValueError for unknown fact types. The recall HTTP handler maps OperationValidationError to its declared status code, but the plain ValueError fell through to the broad exception handler and became a 500 response.

Testing

  • python -m pytest tests/test_recall_invalid_fact_types.py tests/test_http_api_integration.py::test_error_handling tests/test_http_api_integration.py::test_full_api_workflow -v -n 0 — 3 passed
  • ruff check . — passed
  • ruff format --check . — 582 files already formatted
  • ty check hindsight_api/engine/memory_engine.py — passed

Closes #3052

@tao943
tao943 marked this pull request as ready for review July 30, 2026 07:50
@nicoloboschi
nicoloboschi merged commit 4b76d8b into vectorize-io:main Aug 3, 2026
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.

[BUG] POST /memories/recall with invalid fact types returns HTTP 500 instead of 422

2 participants