Error Categories
Errors in the driver are organized into several categories:- Execution Errors - High-level errors from query execution
- Request Errors - Errors from individual request attempts
- Connection Errors - Low-level connection issues
- Metadata Errors - Cluster metadata fetch failures
- Session Creation Errors - Errors during session initialization
Main Error Types
ExecutionError
The main error type returned from query execution methods likequery_unpaged(), execute_unpaged(), and batch().
BadQuery- Invalid statement passed by caller (serialization errors, invalid partition keys, etc.)EmptyPlan- Load balancing policy returned an empty execution planPrepareError- Failed to prepare an unprepared statement with parametersConnectionPoolError- Selected node’s connection pool is in an invalid stateLastAttemptError- Error from the last attempt to execute the requestRequestTimeout- Request exceeded the client-side timeoutUseKeyspaceError-USE KEYSPACE <>request failedSchemaAgreementError- Failed to await schema agreementMetadataError- Metadata error during schema agreement
RequestAttemptError
Error from a single attempt to execute a query. The retry policy uses this error to decide whether to retry.SerializationError- Failed to serialize query parametersCqlRequestSerialization- Failed to serialize the CQL requestUnableToAllocStreamId- No available stream ID for the requestBrokenConnectionError- Connection broke during executionBodyExtensionsParseError- Failed to deserialize frame body extensionsCqlResultParseError- Failed to deserialize RESULT responseCqlErrorParseError- Failed to deserialize ERROR responseDbError(DbError, String)- Database returned an error (see DbError)UnexpectedResponse- Received unexpected response from serverRepreparedIdChanged- Prepared statement ID changed after repreparationRepreparedIdMissingInBatch- Reprepared statement ID not in batchNonfinishedPagingState- Unpaged query returned non-empty paging state
DbError
Database errors returned by ScyllaDB/Cassandra in response to queries. Re-exported fromscylla_cql::frame::response::error.
Unavailable- Not enough replicas available for the consistency levelWriteTimeout- Write acknowledgment timed outReadTimeout- Read response timed outOverloaded- Coordinator node is overloadedSyntaxError- Invalid CQL syntaxAlreadyExists- Table/keyspace already existsUnprepared- Prepared statement is unknown to the serverInvalid- Query is invalid (e.g., wrong column type)
PrepareError
Error returned fromSession::prepare().
ConnectionPoolError- Failed to find a node with working connection poolAllAttemptsFailed- Preparation failed on every connectionPreparedStatementIdsMismatch- Different connections returned different prepared statement IDs
NewSessionError
Error from session creation (viaSessionBuilder::build() or Session::connect()).
FailedToResolveAnyHostname- Couldn’t resolve any provided hostnameEmptyKnownNodesList- No known nodes providedMetadataError- Failed to perform initial metadata fetchUseKeyspaceError- Failed to executeUSE KEYSPACEduring initialization
ConnectionError
Connection-level errors indicating the connection can no longer be used.ConnectTimeout- Connect timeout elapsedIoError- I/O error occurredNoSourcePortForShard- Couldn’t find free source port for shardTranslationError- Address translation failedBrokenConnection- Connection broke after being establishedConnectionSetupRequestError- Connection setup request failed
MetadataError
Errors during cluster metadata fetch and verification.ConnectionPoolError- Control connection pool errorFetchError- Failed to fetch metadata from system tablesPeers- Bad peers metadataKeyspaces- Bad keyspaces metadataUdts- Bad UDT metadataTables- Bad tables metadata
SchemaAgreementError
Error when waiting for schema agreement across cluster nodes.BadQuery
Errors caused by invalid statements passed by the caller.PartitionKeyExtraction- Unable to extract partition key from prepared statementSerializationError- Failed to serialize valuesValuesTooLongForKey- Serialized values too long for partition key computationTooManyQueriesInBatchStatement- Batch exceeds 65,535 statements
Query Result Errors
Errors related to query result processing. SeeQueryResult and QueryRowsResult for details.
IntoRowsResultError
FromQueryResult::into_rows_result():
FirstRowError
FromQueryRowsResult::first_row():
SingleRowError
FromQueryRowsResult::single_row():
Error Handling Patterns
Retryable vs Non-Retryable
Some errors are retryable, others are not:Extracting Database Errors
Handling Timeouts
Connection Issues
Re-exported Error Types
The following error types are re-exported fromscylla_cql:
DeserializationError- Row/value deserialization errorsTypeCheckError- Type checking errorsSerializationError- Value serialization errorsCqlRequestSerializationError- CQL request frame serialization errorsCqlResponseParseError- CQL response frame parsing errors
Related Types
Session- Methods that return these errorsQueryResult- Query result errorsQueryRowsResult- Row access errorsRetryPolicy- Uses errors to make retry decisions
