ErrLookupBackground articles › Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema

Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema

Schema validation failed errors — invalid input schema, document structure is invalid, does not match expected format — appear when a library accepts your data as syntax (usually valid JSON) but rejects its structure: missing required fields, wrong types, unknown keys, out-of-enum values, or contradictory cross-field values. Developers meet this family when registering MCP tools, configuring embedding clients, importing export files, replying to agent events, or calling APIs whose response shape is checked. The fix is almost always to match the documented shape exactly, guided by the field path, key list, or wrapped cause embedded in the message.

Distilled from 187 documented records across 28 repositories.

Background

These errors come from a validation layer that sits between decoding and use. Once JSON parses or a struct deserializes, a guard checks the payload's structure before it is trusted: a JSON Schema compiled with Ajv (Chroma's JS clients) or jsonschema-go (SiYuan's MCP tool registration), a Standard Schema instance validated through Zod/Valibot safeParse (Airi's stage view-state parsers, Caveman's tool inputs), a hand-written type guard (Ruflo's RVFA header, Ruflo's event log, Caveman's integration journals), a whitelist of allowed keys (Rocket.Chat room settings), or construction against a TypedDict (LiteLLM's Nova Canvas params). The guards exist to fail fast: bad input stops before it reaches a tool implementation, a full-text search index, a host tool registry, or rollback logic that cannot recover from malformed state.

From the caller's side the rejection appears at a boundary: a registerTool call, a config set on a collection, a file import, a reply to a pending event, or an HTTP 400 from a server endpoint. Message quality varies widely across the family. Some errors are precise — Chroma concatenates '<instancePath>: <ajv message>' for every violation, the remotive provider embeds the top-level keys it received ('got keys: [message, code]'), and LiteLLM names the field, the expected type, and the actual type. Others wrap their cause (SiYuan's 'invalid input schema: %w', LiteLLM's appended '{e}') or return a rule name in the 400 body (impeccable's appliedEntryIds_must_contain_strings). In every case the payload was syntactically fine; the objection is structural, which separates this family from parse errors such as 'Unexpected token'.

The family varies along two axes: what enforces the schema, and where the schema lives. Enforcement ranges from declarative JSON Schema documents to imperative cross-field checks (Ruflo rejects budgetUsdPerRun greater than budgetUsdMonthly), status-consistency rules (impeccable rejects status 'error' alongside applied entries), and invariant pairings (RustFS requires strict-ingress serde policies to deny unknown fields and compat policies not to). The schema itself may live in code, in version-controlled JSON files that gain required fields on upgrade (Chroma's provider schemas), or only implicitly in whatever a writer emitted — exports, journals, and state files. The implicit case produces a version-drift variant: a file written by an older or newer version (an Airi chat export with a different format marker, ECC's legacy-sync-state schema value, a Caveman journal missing owned blocks, a legacy Chroma collection without vector-index defaults) parses cleanly but fails the current reader's shape check, and the remedy is regeneration with a matched version rather than field-by-field patching.

Common causes

What usually fixes it

Go deeper

Documented occurrences

…and 167 more across the corpus — use search.

Honest provenance: generated on 2026-08-20 from AI-assisted analysis of the linked records. See how records are made.