Skip to content

Commit 37431df

Browse files
committed
docs(error-catalog): name where each length-miss path puts its field entry
A settings write refuses a length miss as 400 SETTINGS_VALIDATION with the entry in details.fields[], not VALIDATION_FAILED; record writes and Zod-parsed bodies answer VALIDATION_FAILED with the entry in fields[] (top-level on /data, under details via the runtime dispatcher). Both entries and their Fix lines now name both envelopes. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv
1 parent ab8b19e commit 37431df

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

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

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,24 +216,38 @@ key runs no write-time check on any field type, so editing it changes nothing.
216216

217217
### `VALUE_TOO_LONG`
218218
**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`.
219+
today.** A length miss is refused as a *field-level* `max_length` entry instead, and where that
220+
entry rides depends on what was written:
221+
222+
- **a record write** (a string over a field's `maxLength`) and **a request body a route parses
223+
with Zod** answer `400 VALIDATION_FAILED` with the entry in `fields[]` — top-level on the
224+
`/data` routes, under `details` when the runtime dispatcher serves it (see
225+
[`VALIDATION_FAILED`](#validation_failed)); on a record write its `constraint` carries
226+
`maxLength` and the `actual` length;
227+
- **a settings write** (a value over its declared maximum) answers `400 SETTINGS_VALIDATION`
228+
with the entry in `details.fields[]`.
229+
224230
**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.
231+
`max_length`, or on `SETTINGS_VALIDATION` + `details.fields[].code` `max_length` for a settings write,
232+
and shorten the value to fit the declared maximum.
226233
**Retry:** `no_retry`
227234

228235
### `VALUE_TOO_SHORT`
229236
**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`.
237+
today.** A length miss is refused as a *field-level* `min_length` entry instead, and where that
238+
entry rides depends on what was written:
239+
240+
- **a record write** (a string under a field's `minLength`) and **a request body a route parses
241+
with Zod** answer `400 VALIDATION_FAILED` with the entry in `fields[]` — top-level on the
242+
`/data` routes, under `details` when the runtime dispatcher serves it (see
243+
[`VALIDATION_FAILED`](#validation_failed)); on a record write its `constraint` carries
244+
`minLength` and the `actual` length;
245+
- **a settings write** (a value under its declared minimum) answers `400 SETTINGS_VALIDATION`
246+
with the entry in `details.fields[]`.
247+
235248
**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.
249+
`min_length`, or on `SETTINGS_VALIDATION` + `details.fields[].code` `min_length` for a settings write,
250+
and lengthen the value to meet the declared minimum.
237251
**Retry:** `no_retry`
238252

239253
### `VALUE_OUT_OF_RANGE`

0 commit comments

Comments
 (0)