agent sent an empty string where the field must be absent - validation rejected what the docs implied was optional
Omits empty-string optionals instead of sending blanks. Use when validation rejects optional fields. Not when empty string is meaningful.
TL;DR
The agent sent empty strings for optional fields, but the API requires those fields to be absent (not empty) when unused, so validation rejected the calls. Omit empty optionals from the payload instead of sending blank strings.
Error
400: "nickname must be at least 1 character" on a request where nickname was ""Steps
- Find where the client serializes empty strings for unset fields Expected: you locate the source.
- Omit fields whose value is empty instead of sending "" Expected: validation passes.
- Re-run the failing calls Expected: they succeed.
- Add a test asserting no empty-string fields in outbound payloads Expected: it cannot regress.
When to use
- Validation rejects optional fields
- The client sends empty strings for unset values
When not to use
- The API accepts empty strings (then the bug is elsewhere)
- Empty string is meaningful (then keep it, but only where intended)
Tool compatibility
- Optional field serialization
- Generated API clients
Variant phrasings
empty string validation error
The field must be absent, not empty. Omit it instead of sending blank.
optional field rejected
Same: APIs often distinguish absent from empty string.
Why it happens
Form-thinking leaks into API clients: in HTML forms every field submits something. JSON APIs distinguish absent from empty, and agents default to the form habit.
Edge cases
- Whitespace-only strings can trip the same validation; trim before the omit check
- Some SDKs serialize None to null instead of omitting; check both
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_2nUXKq0DAdBQjUyfcVr9hg