{"record":{"id":"67ba317bdf480d50","repo":"cube-js/cube","slug":"unknown-schema-format-must-be-one-of-object-val","errorCode":null,"errorMessage":"Unknown schema format. Must be one of ${Object.values(SchemaFormat)}","messagePattern":"Unknown schema format\\. Must be one of (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-server-core/src/core/DevServer.ts","lineNumber":182,"sourceCode":"        throw new Error('Your express app config is missing body-parser middleware. Typical config can look like: `app.use(bodyParser.json({ limit: \\'50mb\\' }));`');\n      }\n\n      if (!req.body.tables) {\n        throw new Error('You have to select at least one table');\n      }\n\n      const dataSource = req.body.dataSource || 'default';\n\n      const driver = await this.cubejsServer.getDriver({\n        dataSource,\n        authInfo: null,\n        securityContext: null,\n        requestId: getRequestIdFromRequest(req),\n      });\n      const tablesSchema = req.body.tablesSchema || (await driver.tablesSchema());\n\n      if (!Object.values(SchemaFormat).includes(req.body.format)) {\n        throw new Error(`Unknown schema format. Must be one of ${Object.values(SchemaFormat)}`);\n      }\n\n      const scaffoldingTemplate = new ScaffoldingTemplate(tablesSchema, driver, {\n        format: req.body.format,\n        snakeCase: true\n      });\n      const files = scaffoldingTemplate.generateFilesByTableNames(req.body.tables, { dataSource });\n\n      await fs.emptyDir(path.join(options.schemaPath, 'cubes'));\n      await fs.emptyDir(path.join(options.schemaPath, 'views'));\n\n      await fs.writeFile(path.join(options.schemaPath, 'views', 'example_view.yml'), `# In Cube, views are used to expose slices of your data graph and act as data marts.\n# You can control which measures and dimensions are exposed to BIs or data apps,\n# as well as the direction of joins between the exposed cubes.\n# You can learn more about views in documentation here - https://cube.dev/docs/schema/reference/view\n\n\n# The following example shows a view defined on top of orders and customers cubes.","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/DevServer.ts#L164-L200","documentation":"Thrown when generating a schema file for download in the development environment: the requested schemaFormat does not match any value of the SchemaFormat enum (e.g. 'sql' or 'js'). The input at fault is the format chosen in the playground's schema-generation UI or passed in the request body.","triggerScenarios":"POSTing to /playground/generate-schema with format absent, misspelled ('yml' instead of 'yaml'), or a value from an older API version.","commonSituations":"Hand-written integration scripts, clients predating the SchemaFormat enum, case-sensitivity ('YAML').","solutions":["Send a supported value, e.g. format: 'yaml' (check Object.values(SchemaFormat) in your installed version)","Fix spelling/case of the format field","Update client integration to the current SchemaFormat enum"],"exampleFix":"// before\nbody: JSON.stringify({ tables: ['public.orders'], format: 'yml' })\n// after\nbody: JSON.stringify({ tables: ['public.orders'], format: 'yaml' })","handlingStrategy":"validation","validationCode":"import { SchemaFormat } from '@cubejs-backend/shared';\nconst formats = Object.values(SchemaFormat);\nif (!formats.includes(body.format)) throw new Error(`format must be one of: ${formats.join(', ')}`);","typeGuard":"const isValidFormat = (f: unknown): f is SchemaFormat => typeof f === 'string' && Object.values(SchemaFormat).includes(f as SchemaFormat);","tryCatchPattern":"try { await generateSchema(body); } catch (e) { if (/Unknown schema format/.test(e.message)) { /* reset to default 'yaml' and retry */ } else throw e; }","preventionTips":["Import and use the SchemaFormat enum rather than hardcoding strings","Default to 'yaml' when format is optional in your flow","Keep client and server packages on matching versions","Beware case sensitivity and abbreviations ('yml')"],"tags":["dev-server","validation","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}