cube-js/cube · error

Parameter with type: ${typeof parameter} is not supported

Error message

Parameter with type: ${typeof parameter} is not supported

What it means

serializeParameter's default case rejects any parameter whose typeof is not one of the supported wire types (string, number, boolean, binary/object-with-binary handling). The message reports the offending typeof so callers can find the bad parameter.

Source

Thrown at packages/cubejs-cubestore-driver/src/WebSocketConnection.ts:531

            builder,
            HttpParameterValue.Float64Value,
            httpParameterValueOffset
          );
        }
      }
      case 'string':
      {
        const valueOffset = builder.createString(parameter);
        const httpParameterValueOffset = StringValue.createStringValue(builder, valueOffset);

        return HttpParameter.createHttpParameter(
          builder,
          HttpParameterValue.StringValue,
          httpParameterValueOffset
        );
      }
      default:
        throw new Error(`Parameter with type: ${typeof parameter} is not supported`);
    }
  }

  public async query(query: string, parameters: QueryParameter[], options: WebSocketQueryOptions): Promise<any[]> {
    const { inlineTables, queryTracingObj, responseFormat } = options;

    const builder = new flatbuffers.Builder(1024);
    const queryOffset = builder.createString(query);

    let traceObjOffset: number | null = null;
    if (queryTracingObj) {
      traceObjOffset = builder.createString(JSON.stringify(queryTracingObj));
    }

    let inlineTablesOffset: number | null = null;
    if (inlineTables && inlineTables.length > 0) {
      const inlineTableOffsets: number[] = [];
      for (const table of inlineTables) {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Log and inspect the parameters array to find the offending value
  2. Convert null explicitly or filter unsupported placeholders
  3. Convert bigint to string; replace functions/undefined with real values
  4. Add a parameter whitelist check before calling query()

Example fix

// before
driver.query('SELECT * FROM t WHERE a = ?', [maybeUndefined]);
// after
driver.query('SELECT * FROM t WHERE a = ?', [maybeUndefined ?? null]);
// or validate
params.forEach(p => {
  if (!['string','number','boolean'].includes(typeof p)) throw new Error('bad param');
});
Defensive patterns

Strategy: type-guard

Validate before calling

function filterParams(params) {
  return params.map(p => {
    if (p === undefined) return null;
    if (typeof p === 'bigint') return p.toString();
    if (typeof p === 'function' || typeof p === 'symbol') {
      throw new Error('unsupported parameter type');
    }
    return p;
  });
}

Type guard

const isSupportedParam = (p) =>
  ['string', 'number', 'boolean'].includes(typeof p) || p === null || isBinaryParam(p);

Try / catch

try {
  return await driver.query(sql, params);
} catch (e) {
  const m = /Parameter with type: (\w+) is not supported/.exec(e.message);
  if (m) {
    console.error('Bad query parameter at:', params.map(p => typeof p));
    return driver.query(sql, coerceParams(params));
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing undefined, null, symbol, function, bigint, or other unsupported-typed values as a query parameter to query().

Common situations: undefined leaked from unassigned variables in template-built params; null filtering conditions; functions passed by mistake; bigint values from ID libraries.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/701774098ceeea12. Report an issue: GitHub.