{"record":{"id":"6b5e4252d3af4945","repo":"apache/cassandra","slug":"runtimeexception-message-for-ks-keyspace-tab","errorCode":null,"errorMessage":"<RuntimeException message> for ks: <keyspace>, table: <table>","messagePattern":"<RuntimeException message> for ks: <keyspace>, table: <table>","errorType":"validation","errorClass":"org.apache.cassandra.exceptions.InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/ColumnFamilyStore.java","lineNumber":1550,"sourceCode":"            StorageHook.instance.reportWrite(metadata.id, update);\n            metric.writeLatency.addNano(nanoTime() - start);\n            int affectedRows = update.affectedRowCount();\n            metric.totalRowsMutated.inc(affectedRows);\n            metric.rowsMutatedPerWriteHistogram.update(affectedRows);\n            // CASSANDRA-11117 - certain resolution paths on memtable put can result in very\n            // large time deltas, either through a variety of sentinel timestamps (used for empty values, ensuring\n            // a minimal write, etc). This limits the time delta to the max value the histogram\n            // can bucket correctly. This also filters the Long.MAX_VALUE case where there was no previous value\n            // to update.\n            if(timeDelta < Long.MAX_VALUE)\n                metric.colUpdateTimeDeltaHistogram.update(Math.min(18165375903306L, timeDelta));\n        }\n        catch (RuntimeException e)\n        {\n            String message = e.getMessage() + \" for ks: \" + keyspace.getName() + \", table: \" + name;\n\n            if (e instanceof InvalidRequestException)\n                throw new InvalidRequestException(message, e);\n\n            throw new RuntimeException(message, e);\n        }\n    }\n    \n    private UpdateTransaction newUpdateTransaction(PartitionUpdate update, CassandraWriteContext context, boolean updateIndexes, Memtable memtable)\n    {\n        return updateIndexes\n               ? indexManager.newUpdateTransaction(update, context, FBUtilities.nowInSeconds(), memtable)\n               : UpdateTransaction.NO_OP;\n    }\n\n    public static class VersionedLocalRanges extends ArrayList<Splitter.WeightedRange>\n    {\n        public final Epoch ringVersion;\n\n        public VersionedLocalRanges(Epoch ringVersion, int initialSize)\n        {","sourceCodeStart":1532,"sourceCodeEnd":1568,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/ColumnFamilyStore.java#L1532-L1568","documentation":"The schema-alteration path in ColumnFamilyStore wraps RuntimeExceptions from the underlying update and rethrows them with keyspace and table context appended ('... for ks: X, table: Y'). If the wrapped exception is an InvalidRequestException it is rethrown as such; any other RuntimeException is rethrown as a plain RuntimeException with the enriched message.","triggerScenarios":"Any operation funneled through this catch block (e.g. schema updates, index or view operations on this table) that throws a non-InvalidRequestException RuntimeException, with the message prefixed by the original exception's message.","commonSituations":"Failures during ALTER TABLE / index builds / view initialization - e.g. custom index class errors, secondary index or materialized-view creation problems - where the root cause message is preserved but annotated with the ks/table.","solutions":["Read the root cause message at the start of the message (before 'for ks:') to identify the actual problem","Check the server log for the full stack trace with the attached cause","Fix the underlying schema operation problem (e.g. drop/recreate the failing index or view)","If caused by a reproducible internal bug, gather the stack trace and report it"],"exampleFix":"// before\nCREATE CUSTOM INDEX ON ks.t (col) USING 'com.example.BrokenIndex'; // RuntimeException from index provider\n// after\nCREATE CUSTOM INDEX ON ks.t (col) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {...}; // valid index class","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { schemaChange(op); } catch (RuntimeException e) { log.error(\"table update failed: {} (cause={})\", e.getMessage(), e.getCause()); /* fix root cause named before 'for ks:' suffix */ }","preventionTips":["Validate custom index/view classes and options against the installed Cassandra version","Test schema changes on a staging cluster first","Keep the original cause chain when logging for diagnosis"],"tags":["cassandra","runtime-exception","schema","context-wrapping"],"backgroundTag":"database-query-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}