{"record":{"id":"b88d66667d9381f3","repo":"apache/cassandra","slug":"modification-is-not-supported-by-table-s","errorCode":null,"errorMessage":"Modification is not supported by table %s","messagePattern":"Modification is not supported by table (.+?)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AbstractLazyVirtualTable.java","lineNumber":774,"sourceCode":"        PartitionsCollector collector = collector(dataRange, columnFilter, rowFilter, limits);\n        try\n        {\n            collect(collector);\n        }\n        catch (InternalDoneException ignore) {}\n        catch (InternalTimeoutException ignore)\n        {\n            if (onTimeout != OnTimeout.BEST_EFFORT || collector.isEmpty())\n                throw new ReadTimeoutException(ONE, 0, 1, false);\n            ClientWarn.instance.warn(\"Ran out of time. Returning best effort.\");\n        }\n        return collector.finish();\n    }\n\n    @Override\n    public void apply(PartitionUpdate update)\n    {\n        throw new InvalidRequestException(\"Modification is not supported by table \" + metadata);\n    }\n\n    @Override\n    public void truncate()\n    {\n        throw new InvalidRequestException(\"Truncation is not supported by table \" + metadata);\n    }\n\n    @Override\n    public String toString()\n    {\n        return metadata().toString();\n    }\n\n    static Object[] composePartitionKeys(DecoratedKey decoratedKey, TableMetadata metadata)\n    {\n        if (metadata.partitionKeyColumns().size() == 1)\n            return new Object[] { metadata.partitionKeyType.compose(decoratedKey.getKey()) };","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AbstractLazyVirtualTable.java#L756-L792","documentation":"AbstractLazyVirtualTable represents read-only lazily-computed virtual tables (e.g. caches stats, transactions). Virtual tables have no storage backing, so apply(PartitionUpdate) for INSERT/UPDATE/DELETE is rejected up front with InvalidRequestException rather than silently ignoring mutations.","triggerScenarios":"Executing INSERT, UPDATE, DELETE, or BATCH containing mutations against a read-only virtual table, e.g. `DELETE FROM system_views.clients` or `INSERT INTO system.caches (...)`.","commonSituations":"Scripts written for normal tables reused against system_views tables; automation trying to 'clean up' virtual table rows; mistaken use of system vs system_views tables.","solutions":["Do not mutate virtual tables — they reflect live in-memory state and are read-only","If the goal is to change runtime state, use the corresponding real mechanism (nodetool commands, system tables designed for writes, or configuration changes)","Point the statement at the intended non-virtual table (check the keyspace: system_views vs system)"],"exampleFix":"// before\nDELETE FROM system_views.clients WHERE address = '127.0.0.1';\n// after\n// use nodetool or the appropriate operational command instead\n$ nodetool disablebinary  // example: change state via tooling, not DML","handlingStrategy":"validation","validationCode":"if (keyspace.startsWith(\"system_views\") || metadata.isVirtual()) throw new UnsupportedOperationException(\"virtual tables are read-only\");","typeGuard":"boolean writable = t -> !t.getMetadata().isVirtual();","tryCatchPattern":"try { session.execute(dml); } catch (InvalidRequestException e) { if (e.getMessage().startsWith(\"Modification is not supported\")) log.error(\"read-only virtual table\"); else throw e; }","preventionTips":["Never generate DML against system_views.* tables","Gate cleanup scripts on metadata().isVirtual()","Use nodetool/config mechanisms to mutate runtime state"],"tags":["cql","virtual-table","read-only","invalid-request"],"backgroundTag":"unsupported-operation","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"}