mastra-ai/mastra · error · Error
Unsupported database kind: ${kind}. Supported kinds: turso,
Error message
Unsupported database kind: ${kind}. Supported kinds: turso, neon, redis What it means
parseKind() whitelists the --kind option to 'turso', 'neon', or 'redis' before creating a database; any other value is rejected with the supported list. This is a deterministic input constraint enforced up front in createDatabaseAction.
Source
Thrown at packages/cli/src/commands/db/db.ts:284
console.info(` Scope: ${formatScope(db, environments)}`);
if (db.region) {
console.info(` Region: ${db.region}`);
}
console.info(` Env vars: ${envVarNamesFor(db.kind)}`);
if (db.error) {
console.info(` Error: ${db.error}`);
}
}
console.info('');
}
/* ------------------------------------------------------------------ */
/* mastra env db create */
/* ------------------------------------------------------------------ */
function parseKind(kind: string): DatabaseKind {
if (kind !== 'turso' && kind !== 'neon' && kind !== 'redis') {
throw new Error(`Unsupported database kind: ${kind}. Supported kinds: turso, neon, redis`);
}
return kind;
}
async function createDatabaseAction(
envArg: string | undefined,
options: {
project?: string;
kind: string;
name?: string;
region?: string;
shared?: boolean;
wait: boolean;
json?: boolean;
},
) {
const kind = parseKind(options.kind);
View on GitHub (pinned to 75dd419e61)
Solutions
- Use one of the supported kinds exactly: --kind turso, --kind neon, or --kind redis (all lowercase).
- If you need a different engine, it is not supported by this command; check the Mastra Cloud docs for current supported database kinds.
- Fix CI scripts/deployment configs that pass an unsupported --kind value.
Example fix
// before mastra env db create prod --kind postgres // after mastra env db create prod --kind neon
Defensive patterns
Strategy: validation
Validate before calling
const KINDS = ['turso', 'neon', 'redis'] as const;
type Kind = typeof KINDS[number];
if (!KINDS.includes(kind as Kind)) {
throw new Error(`--kind must be one of ${KINDS.join(', ')}, got: ${kind}`);
} Type guard
function isDatabaseKind(v: string): v is 'turso' | 'neon' | 'redis' {
return v === 'turso' || v === 'neon' || v === 'redis';
} Try / catch
try {
await createDatabase({ kind });
} catch (e) {
if (/Unsupported database kind/.test((e as Error).message)) {
console.error('Use --kind turso | neon | redis (lowercase).');
}
} Prevention
- Keep the kind literal and lowercase in scripts/configs.
- Type the kind as the union 'turso' | 'neon' | 'redis' in wrapper code.
- Check current docs before assuming new engines are supported.
When it happens
Trigger: `mastra env db create ... --kind postgres` (or any value outside turso|neon|redis), including casing variants like 'Turso'.
Common situations: Assuming other engines (Postgres, MongoDB, SQLite) are supported, capitalizing the kind, or copying an outdated example from docs/CI scripts.
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
- ${flag} must be one of: ${allowed.join(', ')}
- ${flag} must be a positive integer
- Project name must be 1-214 lowercase characters, start with
- Invalid Mastra project
- Template "${template}" not found
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/d2229c09391b5f97.
Report an issue: GitHub.