{"record":{"id":"3c155b8c0fe548e3","repo":"apache/cassandra","slug":"couldn-t-find-table-with-id-s-if-a-table-was-jus","errorCode":null,"errorMessage":"Couldn't find table with id %s. If a table was just created, this is likely due to the schema not being fully propagated.  Please wait for schema agreement on table creation.","messagePattern":"Couldn't find table with id (.+?)\\. If a table was just created, this is likely due to the schema not being fully propagated\\.  Please wait for schema agreement on table creation\\.","errorType":"exception","errorClass":"UnknownTableException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/SchemaProvider.java","lineNumber":193,"sourceCode":"    }\n\n    @Nullable\n    default ColumnMetadata getColumnMetadata(String keyspace, String table, ByteBuffer name)\n    {\n        TableMetadata metadata = getTableMetadata(keyspace, table);\n        if (metadata == null) return null;\n        return metadata.getColumn(name);\n    }\n\n    default TableMetadata getExistingTableMetadata(TableId id) throws UnknownTableException\n    {\n        TableMetadata metadata = getTableMetadata(id);\n        if (metadata != null)\n            return metadata;\n\n        String message = \"Couldn't find table with id \" + id + \". If a table was just created, this is likely due to the schema \"\n                          + \"not being fully propagated.  Please wait for schema agreement on table creation.\";\n        throw new UnknownTableException(message, id);\n    }\n\n    /* Function helpers */\n\n    /**\n     * Get all function overloads with the specified name\n     *\n     * @param name fully qualified function name\n     * @return an empty list if the keyspace or the function name are not found;\n     *         a non-empty collection of {@link Function} otherwise\n     */\n    default Collection<UserFunction> getUserFunctions(FunctionName name)\n    {\n        if (!name.hasKeyspace())\n            throw new IllegalArgumentException(String.format(\"Function name must be fully qualified: got %s\", name));\n\n        KeyspaceMetadata ksm = getKeyspaceMetadata(name.keyspace);\n        return ksm == null","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/SchemaProvider.java#L175-L211","documentation":"SchemaProvider.getExistingTableMetadata resolves a table by TableId and throws UnknownTableException if no table with that UUID exists in the schema. The message warns that if the table was just created, schema may not have fully propagated, so the local node does not yet know the table id.","triggerScenarios":"Routing a request by TableId (internal reads/writes, hints) to a node whose schema copy predates the table creation; getExistingTablePartitioner calling getExistingTableMetadata with a stale or unknown id; data arriving for a table dropped and recreated with a new id.","commonSituations":"Client writes immediately after CREATE TABLE before schema agreement; multi-DC clusters with slow schema propagation; inconsistent schema where a node missed the creation mutation; replayed hints/commitlog segments referencing old table ids.","solutions":["Wait for schema agreement (driver awaitSchemaAgreement or nodetool describecluster) before writing to newly created tables.","Run nodetool resetlocalschema on nodes with persistently divergent schema.","Verify the table id matches the current schema (system_schema.tables id) — if the table was dropped/recreated, use the new id.","Retry the operation after propagation; it is usually transient during normal schema propagation."],"exampleFix":"// before\nsession.execute(\"CREATE TABLE ks.t (id int PRIMARY KEY)\");\nsession.execute(\"INSERT INTO ks.t (id) VALUES (1)\"); // may hit UnknownTableException\n// after\nsession.execute(\"CREATE TABLE ks.t (id int PRIMARY KEY)\");\n// wait for schema agreement before writing\ncluster.getMetadata().checkSchemaAgreement();\nsession.execute(\"INSERT INTO ks.t (id) VALUES (1)\");","handlingStrategy":"retry","validationCode":"boolean schemaInAgreement(Session s) {\n    // all nodes report the same schema version; prefer driver checkSchemaAgreement()\n    return s.execute(\"SELECT schema_version FROM system.local\").one() != null;\n}","typeGuard":null,"tryCatchPattern":"catch (UnknownTableException e) {\n    logger.warn(\"Table id {} unknown locally — waiting for schema agreement\", e.getTableId());\n    Thread.sleep(schemaAgreementWaitMs);\n    retryOperation();\n}","preventionTips":["After CREATE TABLE, wait for schema agreement across the cluster before sending traffic.","Monitor schema disagreement (nodetool describecluster) in multi-DC clusters.","Run nodetool resetlocalschema on nodes stuck with divergent schema versions.","Avoid drop-and-recreate table patterns that invalidate cached TableIds in clients and hints."],"tags":["schema","table-id","schema-agreement","propagation"],"backgroundTag":"resource-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}