MuleSoft · Validation Module
VALIDATION:EMPTY_COLLECTION
Short answer
VALIDATION:EMPTY_COLLECTION is thrown by the Validation module's Is not empty collection operation when the collection is empty. Check the value passed to the validator, and handle the error type if invalid input is something the flow should answer cleanly.
VerifiedLast verified
01Error text
Error type: VALIDATION:EMPTY_COLLECTION02Likely causes
- The Is not empty collection operation failed: the collection is empty.
- If a validation fails, an error is thrown. Its type is always a child of
VALIDATION:VALIDATION.
03How to fix it
- Log the value the validator's expression resolves to, and compare it with what the validator expects.
- Check the query or transformation that builds the collection, and decide whether an empty result is an error.
- Set the validator's Message parameter to say what was wrong, so the error description is useful to the caller.
- Handle the failure with an error handler of type
VALIDATION:EMPTY_COLLECTION, for example to return a 400 response.
04Official documentation
→Related errors
- VALIDATION:NOT_EMPTY_COLLECTIONVALIDATION:NOT_EMPTY_COLLECTION is thrown by the Validation module's Is empty collection operation when the collection was expected to be empty but has elements. Check the value passed to the validator, and handle the error type if invalid input is something the flow should answer cleanly.
- VALIDATION:NULLVALIDATION:NULL is thrown by the Validation module's Is not null operation when the value is null. Check the value passed to the validator, and handle the error type if invalid input is something the flow should answer cleanly.
- VALIDATION:INVALID_SIZEVALIDATION:INVALID_SIZE is thrown by the Validation module's Validate size operation when the size of the value is outside the configured range. Check the value passed to the validator, and handle the error type if invalid input is something the flow should answer cleanly.
Test every fix in a non-production environment before you apply it to production. See how entries are verified.
More for MuleSoft work:Open MuleSoft jobsMuleSoft rates and salariesHire a senior MuleSoft developer