{"record":{"id":"e650307bf5c21f13","repo":"cube-js/cube","slug":"invalid-cube-server-core-options-error-message","errorCode":null,"errorMessage":"Invalid cube-server-core options: ${error.message || error.toString()}","messagePattern":"Invalid cube-server-core options: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-server-core/src/core/optionsValidate.ts","lineNumber":166,"sourceCode":"  sqlPort: Joi.number(),\n  pgSqlPort: Joi.number(),\n  gatewayPort: Joi.number(),\n  sqlSuperUser: Joi.string(),\n  checkSqlAuth: Joi.func(),\n  canSwitchSqlUser: Joi.func(),\n  sqlUser: Joi.string(),\n  sqlPassword: Joi.string(),\n  semanticLayerSync: Joi.func(),\n  // Additional system flags\n  serverless: Joi.boolean(),\n  allowNodeRequire: Joi.boolean(),\n  fastReload: Joi.boolean(),\n});\n\nexport function validateOptions<T>(options: T): T {\n  const { error, value } = schemaOptions.validate(options, { abortEarly: false });\n  if (error) {\n    throw new Error(`Invalid cube-server-core options: ${error.message || error.toString()}`);\n  }\n\n  return value;\n}\n","sourceCodeStart":148,"sourceCodeEnd":171,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/optionsValidate.ts#L148-L171","documentation":"validateOptions runs the Cube server-core options object through a Joi schema (schemaOptions). If any option fails validation, it aggregates the Joi error messages and throws 'Invalid cube-server-core options: ...'. This catches wrong option types and unknown/invalid values early at server construction.","triggerScenarios":"Constructing CubeServer/CubeCore with an options object where any key violates the Joi schema — e.g. wrong type (string instead of boolean), unexpected value format — and validateOptions() is invoked via validated().","commonSituations":"Typos in option names or values; passing environment-derived strings ('true'/'false') where booleans are expected; upgrading Cube and using options that changed shape; passing driver-specific options at the wrong nesting level.","solutions":["Read the Joi error message appended to the error — it names the exact offending option and expected type","Fix the option type/value in the server config to match the schema (booleans for flags, correct numeric ranges, etc.)","Remove unknown/obsolete options or move them to the correct nested object","Pin/align your config with the schema in packages/cubejs-server-core/src/core/optionsValidate.ts for your Cube version"],"exampleFix":"// before\nnew CubeServer({\n  dbType: 'postgres',\n  scheduledRefresh: 'yes'\n});\n// after\nnew CubeServer({\n  dbType: 'postgres',\n  scheduledRefresh: true\n});","handlingStrategy":"validation","validationCode":"import { validateOptions } from './core/optionsValidate';\ntry { validateOptions(myOptions); } catch (e) { console.error(e.message); process.exit(1); }","typeGuard":null,"tryCatchPattern":"try {\n  const server = new CubeServer(options);\n} catch (e) {\n  if (e.message.startsWith('Invalid cube-server-core options:')) {\n    console.error('Config error:', e.message); process.exit(1);\n  } else { throw e; }\n}","preventionTips":["Read the Joi message appended to the error for the exact offending option","Validate config against the schema at CI/startup time","Use typed config objects matching the Cube version's option types","Remove obsolete options when upgrading Cube"],"tags":["configuration","validation","startup"],"backgroundTag":"options-validation-failed","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}