OriginChain docs
examples · errors · 4 / 19

4. 400 - column type mismatch

← Errors examples
what this error means

A value in a row write did not match the column's declared type. OriginChain validates writes against the manifest before they hit the storage substrate - mismatched values are rejected at the boundary, not silently coerced. The same check fires for literals on the right-hand side of a WHERE filter.

what triggers it

Putting a string into a column declared as float64.

PUT /v1/tenants/:t/rows/:table/:pk
curl -X PUT "https://$OC_HOST/v1/tenants/$OC_TENANT/rows/shop.orders/o_42" \
  -H "Authorization: Bearer $OC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id": "o_42", "amount": "not-a-number", "status": "paid"}'
the canonical response body
{
  "error": "type_mismatch",
  "message": "column 'amount' is float64; value 'not-a-number' is not a number",
  "retry": false
}
how to recover
  • Coerce client-side before sending. parseFloat(value), float(value), strconv.ParseFloat.
  • Confirm the column type against the manifest - GET /v1/tenants/:t/schemas/shop.orders.
  • If the column should accept text, alter the schema rather than working around it at the call site.
  • retry: false - same bytes, same answer.
common upstream causes
  • Form fields arriving as strings from HTML inputs without client-side parsing.
  • null sent for a non-null column.
  • Integer overflow - sending 9999999999 into an int32.
  • Timestamp passed as Unix seconds when the column is timestamp_ms.
  • Vector dimension mismatch on an embedding column.
  • Boolean sent as "true" (string) instead of true (JSON literal).