{"record":{"id":"f6ac7616b143348e","repo":"mem0ai/mem0","slug":"invalid-label-name-only-letters-digits-f6ac76","errorCode":null,"errorMessage":"Invalid ${label} '${name}': only letters, digits, and underscores are allowed, must start with a letter or underscore, and be at most 128 characters.","messagePattern":"Invalid (.+?) '(.+?)': only letters, digits, and underscores are allowed, must start with a letter or underscore, and be at most 128 characters\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/vector_stores/databricks.ts","lineNumber":89,"sourceCode":"  indexName: string,\n  operation: \"ReadVectorIndex\" | \"WriteVectorIndex\",\n): string {\n  return JSON.stringify([\n    {\n      type: \"unity_catalog_permission\",\n      securable_type: \"table\",\n      securable_object_name: indexName,\n      operation,\n    },\n  ]);\n}\n\nfunction validateIdentifier(\n  name: string,\n  label: string = \"identifier\",\n): string {\n  if (!SAFE_IDENTIFIER_RE.test(name)) {\n    throw new Error(\n      `Invalid ${label} '${name}': only letters, digits, and underscores are allowed, ` +\n        `must start with a letter or underscore, and be at most 128 characters.`,\n    );\n  }\n  return name;\n}\n\nfunction extractHostAndWorkspaceUrl(config: DatabricksConfig): {\n  host: string;\n  workspaceUrl: string;\n} {\n  if (config.workspaceUrl) {\n    const url = new URL(config.workspaceUrl);\n    return {\n      host: url.host,\n      workspaceUrl: `${url.protocol}//${url.host}`,\n    };\n  }","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/databricks.ts#L71-L107","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nnew Databricks({ catalog: 'main', schema: 'default', tableName: 'mem-memories' });\n\n// after\nnew Databricks({ catalog: 'main', schema: 'default', tableName: 'mem_memories' });","handlingStrategy":"validation","validationCode":"const SAFE_ID = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;\nfunction safeDatabricksName(name: string): string {\n  const cleaned = name.replace(/[^A-Za-z0-9_]/g, '_').replace(/^([0-9])/, '_$1');\n  if (!SAFE_ID.test(cleaned)) throw new Error(`Cannot sanitize identifier: ${name}`);\n  return cleaned;\n}","typeGuard":"const isSafeIdentifier = (n: string): boolean => /^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(n);","tryCatchPattern":null,"preventionTips":["Pass catalog/schema/table as separate validated fields, never a dotted string","Lint config files for hyphenated table names before deploy"],"tags":["databricks","validation","sql-injection","configuration","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}