risingwavelabs/risingwave · error · SinkError::DynamoDb
table {} key schema is empty
Error message
table {} key schema is empty What it means
dynamodb_key_schema_names converts the DescribeTable key schema into key column names. DynamoDB normally guarantees at least one key element (HASH), so an empty key_schema means the AWS response lacked key information and the connector cannot align the RisingWave primary key with the table's key.
Source
Thrown at src/connector/src/sink/dynamodb.rs:421
.fields()
.get(*pk_idx)
.map(|field| field.name.clone())
.ok_or_else(|| {
SinkError::DynamoDb(anyhow!(
"RisingWave primary key column index {} is out of range",
pk_idx
))
})
})
.collect()
}
fn dynamodb_key_schema_names(
table_name: &str,
key_schema: &[KeySchemaElement],
) -> Result<Vec<String>> {
if key_schema.is_empty() {
return Err(SinkError::DynamoDb(anyhow!(
"table {} key schema is empty",
table_name
)));
}
Ok(key_schema
.iter()
.map(|key_element| key_element.attribute_name().to_owned())
.collect())
}
fn validate_pk_matches_dynamodb_key_schema(
table_name: &str,
rw_pk_names: &[String],
dynamodb_keys: &[String],
) -> Result<()> {
let rw_pk_set = rw_pk_names.iter().collect::<BTreeSet<_>>();
let dynamodb_key_set = dynamodb_keys.iter().collect::<BTreeSet<_>>();View on GitHub (pinned to 6469eb736d)
Solutions
- Inspect the table with `aws dynamodb describe-table --table-name <name>` and confirm a valid KeySchema (HASH required).
- Recreate the table with a proper key schema (HASH, optionally + RANGE).
- Check the AWS SDK/endpoint used; a broken mock or proxy may strip key_schema.
- If on dynamodb-local or a mock, fix the fixture to return a realistic DescribeTable response.
Example fix
// before: table created without key schema (invalid) // after aws dynamodb create-table --table-name events --key-schema AttributeName=pk,KeyType=HASH --attribute-definitions AttributeName=pk,AttributeType=S --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
Defensive patterns
Strategy: validation
Validate before calling
aws dynamodb describe-table --table-name events --query 'Table.KeySchema' # must contain at least one HASH key element
Prevention
- Always create DynamoDB tables with an explicit HASH (and optional RANGE) key.
- Use realistic DescribeTable responses in dynamodb-local/mocks and tests.
- Validate table key schema after provisioning in CI.
When it happens
Trigger: DescribeTable returns a table whose KeySchema is empty/absent — e.g. a malformed or partially provisioned table entry, or mocked/test endpoints returning incomplete responses.
Common situations: Testing against dynamodb-local or mocks returning incomplete DescribeTable output; corrupted/abnormally created tables; AWS SDK version responses lacking key_schema.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- table {} not found
- table {} is not active
- DynamoDB table {} primary key {:?} must match RisingWave pri
- No allow_alter_on_fly fields registered for sink: {sink_name
- Field '{field}' is not allowed to be altered on the fly for
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/992d60b89d923292.
Report an issue: GitHub.