mem0ai/mem0 · error · Error
Invalid ${label} '${name}': only letters, digits, and unders
Error message
Invalid ${label} '${name}': only letters, digits, and underscores are allowed, must start with a letter or underscore, and be at most 128 characters. What it means
Databricks catalog/schema/table/index names are interpolated into SQL and Management API calls, so validateIdentifier() enforces SAFE_IDENTIFIER_RE: letters, digits, underscores only; must start with a letter or underscore; at most 128 characters. Invalid names are rejected before any request is made.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/databricks.ts:89
indexName: string,
operation: "ReadVectorIndex" | "WriteVectorIndex",
): string {
return JSON.stringify([
{
type: "unity_catalog_permission",
securable_type: "table",
securable_object_name: indexName,
operation,
},
]);
}
function validateIdentifier(
name: string,
label: string = "identifier",
): string {
if (!SAFE_IDENTIFIER_RE.test(name)) {
throw new Error(
`Invalid ${label} '${name}': only letters, digits, and underscores are allowed, ` +
`must start with a letter or underscore, and be at most 128 characters.`,
);
}
return name;
}
function extractHostAndWorkspaceUrl(config: DatabricksConfig): {
host: string;
workspaceUrl: string;
} {
if (config.workspaceUrl) {
const url = new URL(config.workspaceUrl);
return {
host: url.host,
workspaceUrl: `${url.protocol}//${url.host}`,
};
}View on GitHub (pinned to 001c235229)
Solutions
- Use underscores instead of dashes/dots in catalog, schema, tableName, and indexName (e.g. 'mem0_memories')
- Pass each identifier separately (catalog, schema, tableName), not one dotted string
- Sanitize dynamically generated names before constructing the store
Example fix
// before
new Databricks({ catalog: 'main', schema: 'default', tableName: 'mem-memories' });
// after
new Databricks({ catalog: 'main', schema: 'default', tableName: 'mem_memories' }); Defensive patterns
Strategy: validation
Validate before calling
const SAFE_ID = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
function safeDatabricksName(name: string): string {
const cleaned = name.replace(/[^A-Za-z0-9_]/g, '_').replace(/^([0-9])/, '_$1');
if (!SAFE_ID.test(cleaned)) throw new Error(`Cannot sanitize identifier: ${name}`);
return cleaned;
} Type guard
const isSafeIdentifier = (n: string): boolean => /^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(n); Prevention
- Pass catalog/schema/table as separate validated fields, never a dotted string
- Lint config files for hyphenated table names before deploy
When it happens
Trigger: Configuring the Databricks store with catalog: 'main', schema: 'default', tableName: 'mem0-memories' (dash), or an indexName containing dots/dashes/spaces, or a name longer than 128 chars.
Common situations: Defaulting to hyphenated table names from other databases; using a fully-qualified 'catalog.schema.table' string as tableName; names sourced from tenant/user input with arbitrary characters.
Related errors
- Invalid ${label} '${name}': only letters, digits, and unders
- Databricks vector store: topK must be a positive integer, go
- Invalid ${label} '${name}': only letters, digits, and unders
- Unknown providerOverride '${providerOverride}'. Valid provid
- Databricks vector store requires either workspaceUrl or host
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/f6ac7616b143348e.
Report an issue: GitHub.