cube-js/cube · error · Error
options.meta must be a function
Error message
options.meta must be a function
What it means
Configuration guard in registerInterface (cubejs-backend-native): the generic sentinel `options.meta must be a function` check fires when the SQLInterfaceOptions object passed to registerInterface omits the meta callback, which the native SQL interface needs to serve /meta requests.
Source
Thrown at packages/cubejs-backend-native/js/index.ts:400
export const registerInterface = async (options: SQLInterfaceOptions): Promise<SqlInterfaceInstance> => {
if (typeof options !== 'object' && options == null) {
throw new Error('Argument options must be an object');
}
if (typeof options.contextToApiScopes !== 'function') {
throw new Error('options.contextToApiScopes must be a function');
}
if (typeof options.checkAuth !== 'function') {
throw new Error('options.checkAuth must be a function');
}
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');
}
View on GitHub (pinned to 7d981676b3)
Solutions
- Pass a meta function in the options object when calling registerInterface.
- Verify the object was constructed correctly and meta was not renamed or omitted in a refactor.
Example fix
// before
await registerInterface({ contextToApiScopes, checkAuth, checkSqlAuth, stream, sqlApiLoad });
// after
await registerInterface({
contextToApiScopes, checkAuth, checkSqlAuth,
meta: async (context, query) => compilerApi.meta(context, query),
stream, sqlApiLoad
}); Defensive patterns
Strategy: validation
Validate before calling
if (typeof options.meta !== 'function') {
throw new Error('options.meta must be provided as a function');
} Type guard
function hasMeta(o) {
return typeof o?.meta === 'function';
} Try / catch
try {
await registerInterface(options);
} catch (e) {
if (e.message === 'options.meta must be a function') {
console.error('Provide meta: async (context, query) => compilerApi.meta(context, query).');
} else throw e;
} Prevention
- Pass the existing compilerApi/orchestrator meta handler rather than writing a new one.
- Beware of passing meta as an invoked result or object; always pass the function reference.
- Validate the complete options bag with a helper covering all required callbacks.
When it happens
Trigger: Calling registerInterface() with an options object whose meta property is missing or not a function.
Common situations: Assembling the options programmatically and skipping meta; older integrations where meta was supplied elsewhere; accidental overwrite with a Promise or object instead of the handler function.
Related errors
- options.contextToApiScopes must be a function
- options.checkAuth must be a function
- options.checkSqlAuth must be a function
- options.stream must be a function
- Argument options must be an object
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/01d8641e18948a93.
Report an issue: GitHub.