Guides

Retool Null Value Error with BigQuery: What It Means and How to Fix It

OTC Team··5 min read
Retool Null Value Error with BigQuery: What It Means and How to Fix It

If you've run into the error Parameter types must be provided for null values via the 'types' field in query options while building in Retool, you've likely spent time digging through the docs trying to find where to set query options — only to come up empty. This error surfaces specifically when you're working with BigQuery as your SQL resource and your query includes parameters that resolve to null. Here's what's actually happening, why the docs don't give you a clear answer, and what you can do about it today.

What Does This Error Actually Mean?

BigQuery's client library requires that when a query parameter is null, you explicitly declare the type of that parameter (e.g., STRING, INT64, FLOAT64) in a separate types field passed alongside the query options. Without that type declaration, BigQuery has no way to infer what the null is supposed to represent, and it throws this error.

In most SQL databases — PostgreSQL, MySQL, MS SQL — null parameters are handled more gracefully, which is why this issue is specific to BigQuery. If you've connected Retool to other databases before and never seen this, that's why.

Why You Can't Find "Query Options" in the Retool UI

This is the frustrating part. The error message references a types field in "query options," which implies there's a place in the Retool query editor where you can configure this. As of the time this issue was first raised in the Retool community, Retool does not expose a query options interface for BigQuery queries that allows you to set parameter types manually.

This is a confirmed bug and platform limitation. Retool's team acknowledged it internally and escalated it to the product team. The UI simply doesn't give you the knobs you need to resolve this error on your own — which means the fix has to come from Retool's side, or you need to work around it entirely.

Who Is Affected

  • Anyone using BigQuery as a Retool resource and writing parameterized SQL queries
  • Queries where one or more parameters can be null — for example, optional filter fields left blank in a form
  • Update or insert operations where some columns legitimately store null values

If your query only ever receives non-null values, you won't hit this. But the moment a user submits a form with a blank field that maps to a query parameter, you'll see this error in the query runner.

Workarounds You Can Try Right Now

While Retool works on a native fix, here are practical approaches to prevent null values from reaching your BigQuery parameterized queries:

  • Replace nulls before they hit the query. Use a JavaScript transformer or inline JS in your query parameter to coerce null into a sentinel value. For example, replace a null string with an empty string "" or a value like "N/A" — then handle that sentinel in your BigQuery SQL logic using NULLIF(column, '') to convert it back.
  • Use a JS Query to pre-process inputs. Write a runScript query that inspects all your parameter values before the BigQuery query fires. Strip out or replace any nulls, then pass the sanitized object to your SQL query via query.trigger({ additionalScope: { ... } }).
  • Conditionally build your SQL string. Instead of using parameterized placeholders for optional fields, dynamically construct the WHERE clause in a JavaScript query and pass the full SQL string — avoiding parameterization for the null-prone fields entirely. Note: be careful with SQL injection if any inputs are user-supplied.
  • Set default non-null values in the UI component. If the null originates from a text input or select component, set a default value on the component itself so it never emits null. Use Retool's component defaultValue property to pre-fill with a safe value.

Step-by-Step: Replacing Nulls with a JavaScript Query

This is the most reliable workaround if you have multiple optional parameters:

  • Step 1: Create a new Run Script query in Retool. Name it something like sanitizeParams.
  • Step 2: Inside the script, collect your raw parameter values: const raw = { name: nameInput.value, status: statusSelect.value };
  • Step 3: Replace nulls: const clean = Object.fromEntries(Object.entries(raw).map(([k, v]) => [k, v ?? '']));
  • Step 4: Return the cleaned object and reference its output values in your BigQuery query parameters instead of referencing component values directly.
  • Step 5: In your BigQuery SQL, use NULLIF({{ sanitizeParams.data.status }}, '') to restore the semantic null where needed in the query logic.

What to Expect from Retool

The proper fix requires Retool to pass the types field in the BigQuery query options automatically, inferring or allowing users to declare the expected type for each parameter. This is a platform-level change. Until Retool ships that update, the workarounds above are your best path forward.

If this is blocking you, it's worth opening or upvoting a ticket in the Retool community forum to signal demand for the fix. The more visibility it gets, the faster it moves up the roadmap.

The Bottom Line

The parameter types must be provided for null values error in Retool is a known BigQuery integration bug, not a misconfiguration on your end. There's no hidden "query options" panel to unlock — that part of the API simply isn't surfaced in the Retool UI yet. Use the null-sanitization workarounds above to unblock yourself, and keep an eye on the Retool changelog for a native fix. If you need help implementing any of these patterns inside your Retool app, reach out — this is exactly the kind of thing we solve for clients every day.

Ready to build?

We scope, design, and ship your Retool app — fast.

Ready to ship your first tool?