{"record":{"id":"b0926ffdb781039d","repo":"apache/cassandra","slug":"invalid-table-id","errorCode":null,"errorMessage":"Invalid table id","messagePattern":"Invalid table id","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/TableAttributes.java","lineNumber":112,"sourceCode":"    }\n\n    TableParams asAlteredTableParams(TableParams previous)\n    {\n        if (getId() != null)\n            throw new ConfigurationException(\"Cannot alter table id.\");\n        return build(previous.unbuild());\n    }\n\n    public TableId getId() throws ConfigurationException\n    {\n        String id = getString(ID);\n        try\n        {\n            return id != null ? TableId.fromString(id) : null;\n        }\n        catch (IllegalArgumentException e)\n        {\n            throw new ConfigurationException(\"Invalid table id\", e);\n        }\n    }\n\n    public static Set<String> validKeywords()\n    {\n        return ImmutableSet.copyOf(validKeywords);\n    }\n\n    public static Set<String> allKeywords()\n    {\n        return Sets.union(validKeywords, obsoleteKeywords);\n    }\n\n    private TableParams build(TableParams.Builder builder)\n    {\n        if (hasOption(ALLOW_AUTO_SNAPSHOT))\n            builder.allowAutoSnapshot(getBoolean(ALLOW_AUTO_SNAPSHOT.toString(), true));\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/TableAttributes.java#L94-L130","documentation":"TableAttributes.getId() parses the `id` attribute string into a TableId via TableId.fromString. If the string is not a valid UUID/table-id representation, the IllegalArgumentException is wrapped as ConfigurationException 'Invalid table id'.","triggerScenarios":"CREATE TABLE ... WITH id = 'not-a-uuid' or any malformed id string.","commonSituations":"Typos or truncated UUIDs in schema files; ids copied without quotes/format from other systems; hand-written CQL with fabricated ids.","solutions":["Supply a valid UUID-formatted table id (8-4-4-4-12 hex)","Generate a fresh id (uuidgen or TableId.randomUUID-equivalent) instead of hand-writing one","Omit the id attribute entirely so Cassandra assigns one"],"exampleFix":"// before\nCREATE TABLE t (...) WITH id = 'abc123';\n// after\nCREATE TABLE t (...) WITH id = '1a2b3c4d-0000-4000-8000-000000000000';","handlingStrategy":"validation","validationCode":"const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nif (id !== undefined && !UUID_RE.test(id)) throw new Error(`Invalid table id: ${id}`);","typeGuard":"function isTableId(v) { return typeof v === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v); }","tryCatchPattern":"try {\n  applyDdl(ddl);\n} catch (e) {\n  if (/Invalid table id/.test(e.message)) { /* regenerate a valid UUID and retry */ }\n  else throw e;\n}","preventionTips":["Generate ids with a UUID library, never by hand","Validate UUID format before embedding into DDL","Omit the id attribute unless you specifically need a deterministic table id"],"tags":["cql","table","uuid","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-15T13:17:12.816Z"}