apache/cassandra · error · ConfigurationException

Invalid table id

Error message

Invalid table id

What it means

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'.

Source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/TableAttributes.java:112

    }

    TableParams asAlteredTableParams(TableParams previous)
    {
        if (getId() != null)
            throw new ConfigurationException("Cannot alter table id.");
        return build(previous.unbuild());
    }

    public TableId getId() throws ConfigurationException
    {
        String id = getString(ID);
        try
        {
            return id != null ? TableId.fromString(id) : null;
        }
        catch (IllegalArgumentException e)
        {
            throw new ConfigurationException("Invalid table id", e);
        }
    }

    public static Set<String> validKeywords()
    {
        return ImmutableSet.copyOf(validKeywords);
    }

    public static Set<String> allKeywords()
    {
        return Sets.union(validKeywords, obsoleteKeywords);
    }

    private TableParams build(TableParams.Builder builder)
    {
        if (hasOption(ALLOW_AUTO_SNAPSHOT))
            builder.allowAutoSnapshot(getBoolean(ALLOW_AUTO_SNAPSHOT.toString(), true));

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Supply a valid UUID-formatted table id (8-4-4-4-12 hex)
  2. Generate a fresh id (uuidgen or TableId.randomUUID-equivalent) instead of hand-writing one
  3. Omit the id attribute entirely so Cassandra assigns one

Example fix

// before
CREATE TABLE t (...) WITH id = 'abc123';
// after
CREATE TABLE t (...) WITH id = '1a2b3c4d-0000-4000-8000-000000000000';
Defensive patterns

Strategy: validation

Validate before calling

const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (id !== undefined && !UUID_RE.test(id)) throw new Error(`Invalid table id: ${id}`);

Type guard

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); }

Try / catch

try {
  applyDdl(ddl);
} catch (e) {
  if (/Invalid table id/.test(e.message)) { /* regenerate a valid UUID and retry */ }
  else throw e;
}

Prevention

When it happens

Trigger: CREATE TABLE ... WITH id = 'not-a-uuid' or any malformed id string.

Common situations: Typos or truncated UUIDs in schema files; ids copied without quotes/format from other systems; hand-written CQL with fabricated ids.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/b0926ffdb781039d. Report an issue: GitHub.