cube-js/cube · error

Parameter with type: object is not supported

Error message

Parameter with type: object is not supported

What it means

serializeParameter converts JS query parameters into flatbuffer HttpParameter values; plain JS objects are not a representable wire type, so the driver throws. Parameters must be string, number, boolean, or binary.

Source

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

        HttpParameterValue.NullValue,
        httpParameterValueOffset
      );
    }

    switch (typeof parameter) {
      case 'object':
      {
        if (Buffer.isBuffer(parameter)) {
          const valueOffset = BinaryValue.createVVector(builder, parameter);
          const httpParameterValueOffset = BinaryValue.createBinaryValue(builder, valueOffset);

          return HttpParameter.createHttpParameter(
            builder,
            HttpParameterValue.BinaryValue,
            httpParameterValueOffset
          );
        } else {
          throw new Error('Parameter with type: object is not supported');
        }
      }
      case 'boolean':
      {
        const httpParameterValueOffset = BoolValue.createBoolValue(
          builder,
          parameter
        );

        return HttpParameter.createHttpParameter(
          builder,
          HttpParameterValue.BoolValue,
          httpParameterValueOffset
        );
      }
      case 'number':
      {
        if (Number.isInteger(parameter)) {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Serialize the object to a JSON string before passing it
  2. Primitives: expand arrays into individual placeholders (?,?,?)
  3. Convert Date to an ISO string
  4. Pre-validate parameter types before calling query()

Example fix

// before
driver.query('SELECT * FROM t WHERE id IN (?)', [[1,2,3]]);
// after
driver.query('SELECT * FROM t WHERE id IN (?, ?, ?)', [1, 2, 3]);
Defensive patterns

Strategy: type-guard

Validate before calling

function assertSupportedParams(params) {
  params.forEach((p, i) => {
    if (Array.isArray(p)) throw new Error(`param ${i}: expand arrays into individual placeholders`);
    if (p !== null && p !== undefined && typeof p === 'object' && !isBinaryParam(p)) {
      throw new Error(`param ${i}: serialize object to JSON string first`);
    }
  });
}

Type guard

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

Try / catch

try {
  return await driver.query(sql, params);
} catch (e) {
  if (/Parameter with type: object is not supported/.test(e.message)) {
    return driver.query(sql, params.map(p =>
      (p && typeof p === 'object' && !isBinaryParam(p)) ? JSON.stringify(p) : p));
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing a JavaScript object (e.g. an array, Date, or nested object) as a query parameter to driver.query() against Cube Store.

Common situations: Passing an array for an IN clause instead of expanding placeholders; passing Date objects or JSON blobs unserialized; ORM-built parameter objects.

Related errors


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