Skip to content

Commit ab8b19e

Browse files
committed
docs(error-catalog): VALUE_TOO_LONG / VALUE_TOO_SHORT name the field-level codes that really arrive
No producer emits either top-level code; a length miss is refused inside VALIDATION_FAILED with fields[].code max_length / min_length (record validator, settings values, Zod-parsed request bodies). Both entries now say so and tell clients to branch on VALIDATION_FAILED + fields[].code, mirroring the INVALID_FORMAT entry. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv
1 parent e8f163f commit ab8b19e

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎content/docs/api/error-catalog.mdx‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,25 @@ key runs no write-time check on any field type, so editing it changes nothing.
215215
**Retry:** `no_retry`
216216

217217
### `VALUE_TOO_LONG`
218-
**Cause:** String value exceeds the field's `maxLength` constraint.
219-
**Fix:** Truncate the value to the maximum allowed length.
218+
**Cause:** Reserved for a string value longer than its declared maximum. **No route emits it
219+
today.** A string over a field's `maxLength` is refused as a *field-level* failure inside
220+
`VALIDATION_FAILED` instead, with `fields[].code` `max_length`; on a record write that entry's
221+
`constraint` carries `maxLength` and the `actual` length. A settings value over its declared
222+
maximum, and a string in a request body a route parses with Zod, also answer field-level
223+
`max_length`.
224+
**Fix:** Do not branch on this code; branch on `VALIDATION_FAILED` + `fields[].code`
225+
`max_length`, and shorten the value to fit the declared maximum.
220226
**Retry:** `no_retry`
221227

222228
### `VALUE_TOO_SHORT`
223-
**Cause:** String value is below the field's `minLength` constraint.
224-
**Fix:** Provide a longer value that meets the minimum length requirement.
229+
**Cause:** Reserved for a string value shorter than its declared minimum. **No route emits it
230+
today.** A string under a field's `minLength` is refused as a *field-level* failure inside
231+
`VALIDATION_FAILED` instead, with `fields[].code` `min_length`; on a record write that entry's
232+
`constraint` carries `minLength` and the `actual` length. A settings value under its declared
233+
minimum, and a string in a request body a route parses with Zod, also answer field-level
234+
`min_length`.
235+
**Fix:** Do not branch on this code; branch on `VALIDATION_FAILED` + `fields[].code`
236+
`min_length`, and lengthen the value to meet the declared minimum.
225237
**Retry:** `no_retry`
226238

227239
### `VALUE_OUT_OF_RANGE`

0 commit comments

Comments
 (0)