{"record":{"id":"c9f78d9e4b349729","repo":"prestodb/presto","slug":"cassandra-error-c9f78d","errorCode":"CASSANDRA_ERROR","errorMessage":"Error appending page to %s.%s: %s","messagePattern":"Error appending page to (.+?)\\.(.+?): (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-cassandra/src/main/java/com/facebook/presto/cassandra/CassandraPageSink.java","lineNumber":150,"sourceCode":"\n                for (int channel = 0; channel < page.getChannelCount(); channel++) {\n                    appendColumn(values, page, position, channel);\n                }\n\n                BoundStatement boundStatement = insert.bind(values.toArray());\n                cassandraSession.execute(boundStatement);\n                rowsWritten++;\n            }\n\n            return NOT_BLOCKED;\n        }\n        catch (PrestoException e) {\n            // Re-throw PrestoExceptions as-is\n            throw e;\n        }\n        catch (Exception e) {\n            log.error(e, \"Error appending page to %s.%s\", schemaName, tableName);\n            throw new PrestoException(CASSANDRA_ERROR,\n                format(\"Error appending page to %s.%s: %s\", schemaName, tableName, e.getMessage()), e);\n        }\n    }\n\n    private void appendColumn(List<Object> values, Page page, int position, int channel)\n    {\n        Block block = page.getBlock(channel);\n        Type type = columnTypes.get(channel);\n        if (block.isNull(position)) {\n            values.add(null);\n        }\n        else if (BOOLEAN.equals(type)) {\n            values.add(type.getBoolean(block, position));\n        }\n        else if (BIGINT.equals(type)) {\n            values.add(type.getLong(block, position));\n        }\n        else if (INTEGER.equals(type)) {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-cassandra/src/main/java/com/facebook/presto/cassandra/CassandraPageSink.java#L132-L168","documentation":"CassandraPageSink.appendPage wraps any non-PrestoException failure while writing a page of rows to a Cassandra table in a generic CASSANDRA_ERROR. The original exception (e.g. a driver write timeout, invalid query, or coordinator failure) is preserved as the cause and its message is embedded in the error text.","triggerScenarios":"Calling appendPage during an INSERT into a Cassandra table when the underlying driver session write fails — write timeouts, unavailable replicas, invalid requests (bad TTL/timestamp), or schema disagreements between Presto and Cassandra.","commonSituations":"Inserting rows while a Cassandra node is down or repairing; consistency level cannot be met; the table was altered/dropped concurrently; batch too large or client-side throttling rejecting writes.","solutions":["Read the wrapped cause message (%s) to identify the driver-level failure and fix that root cause","Check Cassandra cluster health (nodetool status) and retry the INSERT once replicas are available","Verify the target table schema matches the INSERT column list","Increase write timeout / consistency settings if timeouts are the cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Check cluster health before bulk insert\nResultSet rs = session.execute(\"SELECT count(*) FROM system.local\");\nif (rs == null || rs.one() == null) {\n    throw new IllegalStateException(\"Cassandra unreachable, skip insert\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    pageSink.appendPage(page).get();\n} catch (PrestoException e) {\n    if (CASSANDRA_ERROR.toErrorCode().getCode() == e.getErrorCode().getCode()) {\n        Throwable cause = e.getCause();\n        if (cause instanceof WriteTimeoutException) {\n            retryWithBackoff(page);\n        }\n    }\n    throw e;\n}","preventionTips":["Monitor Cassandra node health before large writes","Keep table schema stable during inserts","Use idempotent inserts so retries are safe","Tune write consistency/timeout settings for your workload"],"tags":["cassandra","write-failure","insert","driver"],"backgroundTag":"cassandra-write-failure","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}