Skip to content

MOPS-608: Add InvalidEntityDataError for better entity validation errors#47

Merged
owen-oclee-ki merged 2 commits into
masterfrom
invalid-entity-data-error
Jan 9, 2026
Merged

MOPS-608: Add InvalidEntityDataError for better entity validation errors#47
owen-oclee-ki merged 2 commits into
masterfrom
invalid-entity-data-error

Conversation

@owen-oclee-ki

@owen-oclee-ki owen-oclee-ki commented Jan 8, 2026

Copy link
Copy Markdown
  • Adds InvalidEntityDataError exception for entity validation failures in online feature requests
  • Previously these returned cryptic errors AssertionError, ValueError, KeyError etc
  • Now raises clear semantically meaningful errors that downstream services (i.e. feature-store-connector) can catch and surface to users

n.b. there will be a follow up PR in feature-store-connector to take advantage of these which will allow the following improvements:

Scenario Before After
Entity key doesn't exist in project 500 400 ✅
Entity key exists but wrong for feature view 500 400 ✅
Wrong entity value type 500 400 ✅
Partial composite key (missing required keys) 200 (null) 400 ✅

Example error messages

Entity totally_wrong_key does not exist in project ki_feature_store
None of the provided entity keys ['prior_policy_ref'] match the required 
entity keys ['companyid', 'calendaryear', 'calendarmonth'] for feature view 'company_market_cap_fv_v2'
Missing required entity keys ['calendaryear', 'calendarmonth'] for feature view 'company_market_cap_fv_v2'. 
Provided: ['companyid'], Required: ['companyid', 'calendaryear', 'calendarmonth']
Failed to convert entity value 'not_a_number' to ValueType.INT64: invalid literal for int() with base 10: 'not_a_number'

Previously, invalid entity data in online feature requests would result in
cryptic errors (AssertionError, ValueError, KeyError) that bubbled up as
500 Internal Server Errors. This change adds a dedicated exception type
and raises it with helpful error messages for common issues:

- Entity key doesn't exist in the project (EntityNotFoundException)
- Entity key exists but doesn't match the feature view's required keys
- Entity value has wrong type for the expected schema
- Partial composite key provided (missing required entity keys)

Changes:
- errors.py: Add InvalidEntityDataError exception class
- utils.py: Validate entity keys match feature view requirements
- type_map.py: Wrap type assertions and value conversions with proper errors
@owen-oclee-ki owen-oclee-ki requested a review from Copilot January 8, 2026 15:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Introduces InvalidEntityDataError exception to provide clear, actionable error messages when entity validation fails during online feature requests, replacing cryptic built-in exceptions like AssertionError and ValueError. This enables downstream services to properly handle validation failures and return appropriate 400-level HTTP status codes instead of 500s.

  • Adds new InvalidEntityDataError exception class for entity validation failures
  • Replaces assertions with explicit error checking in entity key matching and type conversion
  • Provides descriptive error messages showing what was provided vs. what was expected

Reviewed changes

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

File Description
sdk/python/feast/errors.py Defines new InvalidEntityDataError exception with documentation
sdk/python/feast/utils.py Validates entity keys and raises InvalidEntityDataError when keys don't match or are missing
sdk/python/feast/type_map.py Replaces assertions with explicit type checking and converts value conversion failures to InvalidEntityDataError

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

Comment thread sdk/python/feast/utils.py
Comment thread sdk/python/feast/type_map.py
Comment thread sdk/python/feast/type_map.py
@owen-oclee-ki

Copy link
Copy Markdown
Author

regarding the unit test failures, looks like they've been failing for a while: https://github.com/Ki-Insurance/feast/actions/runs/16492189884

not relevant to this change. would be a good idea to try and rebase against mainline soon and hopefully they will get fixed as part of that.

@owen-oclee-ki owen-oclee-ki changed the title Add InvalidEntityDataError for better entity validation errors MOPS-608: Add InvalidEntityDataError for better entity validation errors Jan 8, 2026
@owen-oclee-ki owen-oclee-ki merged commit a98ead3 into master Jan 9, 2026
16 of 21 checks passed
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.

3 participants