Raise ContentValidationFailed for data_validation_error - #22
Merged
Merged
Conversation
A Flux resource write reports a schema violation with error_code "data_validation_error", which was not mapped, so the most common way to reach a schema violation raised a bare FoxnoseAPIError and the documented `except ContentValidationFailed` never fired for it. Callers were left matching on `status_code == 422`, which also catches unrelated 422s. Both codes describe the same failure and carry the same detail payload -- the resource-write path raises RevisionValidationError, other paths raise the content variant -- so both now map to the same class and populate `errors` and `errors_truncated` identically. `error_code` still reports what the server actually sent. Verified against a live backend: a write omitting a required field now raises ContentValidationFailed with its json_paths parsed.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Sep 9, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A Flux resource write reports a schema violation with
error_code="data_validation_error", which was not mapped. The most common wayto reach a schema violation therefore raised a bare
FoxnoseAPIError, and thedocumented
except ContentValidationFailednever fired for it — callers wereleft matching on
status_code == 422, which also catches unrelated 422s.Both codes describe the same failure and carry the same detail payload: the
resource-write path raises
RevisionValidationError(data_validation_error),other paths raise the content variant. Both now map to
ContentValidationFailedand populate
errorsanderrors_truncatedidentically.error_codestillreports what the server actually sent, so nothing that inspects it changes.
Only these two codes map — an unrelated 422 still falls through to the base
class, which is covered by a test.
Verified against a live backend: a write omitting a required field now raises
ContentValidationFailedwith itsjson_pathentries parsed. Mutation-checked— the new tests fail when the code is dropped from the set.
Found while releasing langchain-foxnose 0.4.0, whose docs currently work around
this by matching on the status code (FoxNoseTech/langchain-foxnose#8). Those can
be simplified once this ships.