OriginChain docs
examples · errors · 16 / 19

16. 422 - semantically invalid manifest

← Errors examples
what this error means

The request parsed correctly (TOML is syntactically valid) but failed a higher-level semantic check. 422 is the bucket for "syntax fine, meaning wrong" - foreign key targets that don't exist, primary keys with no columns, vector dims that don't match the declared embedding model, etc.

what triggers it

A manifest where a foreign key points at a column that doesn't exist on the target table.

PUT /v1/tenants/:t/schemas/:id
curl -X PUT "https://$OC_HOST/v1/tenants/$OC_TENANT/schemas/shop.orders" \
  -H "Authorization: Bearer $OC_TOKEN" \
  -H "Content-Type: application/toml" \
  --data-binary @- <<'TOML'
[table]
name = "shop.orders"

[[column]]
name = "id"
type = "string"
primary_key = true

[[column]]
name = "customer_id"
type = "string"

[[foreign_key]]
column = "customer_id"
references = "shop.customers.missing_pk"
TOML
the canonical response body
{
  "error": "invalid_manifest",
  "message": "foreign key target 'shop.customers.missing_pk' does not exist",
  "retry": false
}
how to recover
  • Read the message - it names the exact target the validator could not find.
  • Fetch the referenced table's manifest and confirm the column exists with the spelling you used.
  • If the target table needs to be created or extended first, do that before registering this manifest.
  • Run the schema through POST /v1/tenants/:t/schemas/_validate first - same checks, no commit.
  • retry: false - same bytes, same answer. Fix the manifest first.
common upstream causes
  • FK target table not registered yet (apply manifests in the right order).
  • Typo in the FK target column name.
  • Primary key column missing the primary_key = true flag on the target.
  • Vector column's declared dim doesn't match the embedding model.
  • Two indexes with the same name on one table.
  • CHECK constraint with the field expr (legacy) instead of the current expression.