cube-js/cube · error · Error
Unknown schema format. Must be one of ${Object.values(Schema
Error message
Unknown schema format. Must be one of ${Object.values(SchemaFormat)} What it means
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.
Source
Thrown at packages/cubejs-server-core/src/core/DevServer.ts:182
throw new Error('Your express app config is missing body-parser middleware. Typical config can look like: `app.use(bodyParser.json({ limit: \'50mb\' }));`');
}
if (!req.body.tables) {
throw new Error('You have to select at least one table');
}
const dataSource = req.body.dataSource || 'default';
const driver = await this.cubejsServer.getDriver({
dataSource,
authInfo: null,
securityContext: null,
requestId: getRequestIdFromRequest(req),
});
const tablesSchema = req.body.tablesSchema || (await driver.tablesSchema());
if (!Object.values(SchemaFormat).includes(req.body.format)) {
throw new Error(`Unknown schema format. Must be one of ${Object.values(SchemaFormat)}`);
}
const scaffoldingTemplate = new ScaffoldingTemplate(tablesSchema, driver, {
format: req.body.format,
snakeCase: true
});
const files = scaffoldingTemplate.generateFilesByTableNames(req.body.tables, { dataSource });
await fs.emptyDir(path.join(options.schemaPath, 'cubes'));
await fs.emptyDir(path.join(options.schemaPath, 'views'));
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.
# You can control which measures and dimensions are exposed to BIs or data apps,
# as well as the direction of joins between the exposed cubes.
# You can learn more about views in documentation here - https://cube.dev/docs/schema/reference/view
# The following example shows a view defined on top of orders and customers cubes.View on GitHub (pinned to 7d981676b3)
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
Example fix
// before
body: JSON.stringify({ tables: ['public.orders'], format: 'yml' })
// after
body: JSON.stringify({ tables: ['public.orders'], format: 'yaml' }) Defensive patterns
Strategy: validation
Validate before calling
import { SchemaFormat } from '@cubejs-backend/shared';
const formats = Object.values(SchemaFormat);
if (!formats.includes(body.format)) throw new Error(`format must be one of: ${formats.join(', ')}`); Type guard
const isValidFormat = (f: unknown): f is SchemaFormat => typeof f === 'string' && Object.values(SchemaFormat).includes(f as SchemaFormat);
Try / catch
try { await generateSchema(body); } catch (e) { if (/Unknown schema format/.test(e.message)) { /* reset to default 'yaml' and retry */ } else throw e; } Prevention
- 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')
When it happens
Trigger: POSTing to /playground/generate-schema with format absent, misspelled ('yml' instead of 'yaml'), or a value from an older API version.
Common situations: Hand-written integration scripts, clients predating the SchemaFormat enum, case-sensitivity ('YAML').
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- You have to select at least one table
- ${type} is required
- Wrong driver
- Can't parse date: '${from}'
- Can't parse date: '${to}'
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/67ba317bdf480d50.
Report an issue: GitHub.