Summary
An error stating "data is not an array" appears when attempting to save changes back to the server using the code shown in the query editor.
AI Response
This error occurs because write, bulk insert, and bulk update operations expect the payload to be formatted as an array of record objects, not a single object or other value. The fix is to wrap or transform the data so it resolves to an array (e.g. [ { ... }, { ... } ]) before passing it into the query — for a table, referencing the changeset/record updates array, or for custom code, using a transformer or JS to return an array. Confirm the value feeding the query evaluates to an array in the state inspector, and match the field/key names to what the destination expects.
Sources
How do I transform json results into an array for importing into retool database
Solved thread covering the same "data needs to be in an array" error, resolved by transforming the payload into an array before the write.
Format for bulk insert records
Solved thread that walks through the correct array-of-records format required for bulk insert/update queries.
The Community Team is testing out a new automation. Let us know if it's helpful (or not) by leaving a
,
, or
. Or by marking this post as the "Solution"! Let us know if you have any feedback here. ![]()