cube-js/cube · error · Error

options.sqlGenerators must be a function

Error message

options.sqlGenerators must be a function

What it means

Configuration guard in registerInterface (cubejs-backend-native): fires when options.sqlGenerators is not a function. The native backend uses this callback to obtain SQL generators per data source, so its absence indicates an incomplete SQLInterfaceOptions object at setup time.

Source

Thrown at packages/cubejs-backend-native/js/index.ts:412

  if (typeof options.checkSqlAuth !== 'function') {
    throw new Error('options.checkSqlAuth must be a function');
  }

  if (typeof options.meta !== 'function') {
    throw new Error('options.meta must be a function');
  }

  if (typeof options.stream !== 'function') {
    throw new Error('options.stream must be a function');
  }

  if (typeof options.sqlApiLoad !== 'function') {
    throw new Error('options.sqlApiLoad must be a function');
  }

  if (typeof options.sqlGenerators !== 'function') {
    throw new Error('options.sqlGenerators must be a function');
  }

  if (typeof options.sql !== 'function') {
    throw new Error('options.sql must be a function');
  }

  const native = loadNative();
  return native.registerInterface({
    ...options,
    contextToApiScopes: wrapNativeFunctionWithChannelCallback(options.contextToApiScopes),
    checkAuth: wrapNativeFunctionWithChannelCallback(options.checkAuth),
    checkSqlAuth: wrapNativeFunctionWithChannelCallback(options.checkSqlAuth),
    sql: wrapNativeFunctionWithChannelCallback(options.sql),
    meta: wrapNativeFunctionWithChannelCallback(options.meta),
    stream: wrapNativeFunctionWithStream(options.stream),
    sqlApiLoad: wrapNativeFunctionWithStream(options.sqlApiLoad),
    sqlGenerators: wrapRawNativeFunctionWithChannelCallback(options.sqlGenerators),
    logLoadEvent: wrapRawNativeFunctionWithChannelCallback(options.logLoadEvent),

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Pass an sqlGenerators function in the registerInterface options.
  2. Check for typos (e.g. sqlGenerator singular) in the options object construction.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-backend-native/js/index.ts:412 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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