prestodb/presto · error · PrestoException

CASSANDRA_ERROR

CASSANDRA_ERROR

Error message

Error appending page to %s.%s: %s

What it means

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.

Source

Thrown at presto-cassandra/src/main/java/com/facebook/presto/cassandra/CassandraPageSink.java:150

                for (int channel = 0; channel < page.getChannelCount(); channel++) {
                    appendColumn(values, page, position, channel);
                }

                BoundStatement boundStatement = insert.bind(values.toArray());
                cassandraSession.execute(boundStatement);
                rowsWritten++;
            }

            return NOT_BLOCKED;
        }
        catch (PrestoException e) {
            // Re-throw PrestoExceptions as-is
            throw e;
        }
        catch (Exception e) {
            log.error(e, "Error appending page to %s.%s", schemaName, tableName);
            throw new PrestoException(CASSANDRA_ERROR,
                format("Error appending page to %s.%s: %s", schemaName, tableName, e.getMessage()), e);
        }
    }

    private void appendColumn(List<Object> values, Page page, int position, int channel)
    {
        Block block = page.getBlock(channel);
        Type type = columnTypes.get(channel);
        if (block.isNull(position)) {
            values.add(null);
        }
        else if (BOOLEAN.equals(type)) {
            values.add(type.getBoolean(block, position));
        }
        else if (BIGINT.equals(type)) {
            values.add(type.getLong(block, position));
        }
        else if (INTEGER.equals(type)) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Read the wrapped cause message (%s) to identify the driver-level failure and fix that root cause
  2. Check Cassandra cluster health (nodetool status) and retry the INSERT once replicas are available
  3. Verify the target table schema matches the INSERT column list
  4. Increase write timeout / consistency settings if timeouts are the cause
Defensive patterns

Strategy: retry

Validate before calling

// Check cluster health before bulk insert
ResultSet rs = session.execute("SELECT count(*) FROM system.local");
if (rs == null || rs.one() == null) {
    throw new IllegalStateException("Cassandra unreachable, skip insert");
}

Try / catch

try {
    pageSink.appendPage(page).get();
} catch (PrestoException e) {
    if (CASSANDRA_ERROR.toErrorCode().getCode() == e.getErrorCode().getCode()) {
        Throwable cause = e.getCause();
        if (cause instanceof WriteTimeoutException) {
            retryWithBackoff(page);
        }
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/c9f78d9e4b349729. Report an issue: GitHub.