{"record":{"id":"15daaf9d3c832413","repo":"risingwavelabs/risingwave","slug":"failed-to-write-items-to-dynamodb-sink","errorCode":null,"errorMessage":"failed to write items to DynamoDB sink","messagePattern":"failed to write items to DynamoDB sink","errorType":"error_code","errorClass":"SinkError::DynamoDb","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/dynamodb.rs","lineNumber":602,"sourceCode":"                                                consumed_capacity = ?output.consumed_capacity(),\n                                                \"DynamoDB batch write retry succeeded\"\n                                            );\n                                        }\n                                        return Ok(());\n                                    }\n\n                                    req_items = unprocessed_items.into_values().flatten().collect();\n                                    if retry_count >= batch_write_retry_times {\n                                        return Err(SinkError::DynamoDb(anyhow!(\n                                            \"failed to write {} unprocessed items to DynamoDB sink after {} retries\",\n                                            req_items.len(),\n                                            batch_write_retry_times,\n                                        )));\n                                    }\n                                }\n                                Err(e) => {\n                                    return Err(SinkError::DynamoDb(\n                                        anyhow!(e).context(\"failed to write items to DynamoDB sink\"),\n                                    ));\n                                }\n                            }\n\n                            retry_count += 1;\n                            let Some(delay) = retry_backoff.next() else {\n                                return Err(SinkError::DynamoDb(anyhow!(\n                                    \"failed to write {} unprocessed items to DynamoDB sink after {} retries\",\n                                    req_items.len(),\n                                    batch_write_retry_times,\n                                )));\n                            };\n                            tracing::warn!(\n                                retry_count,\n                                delay_ms = delay.as_millis(),\n                                unprocessed_items_count = req_items.len(),\n                                \"retrying DynamoDB batch write\"\n                            );","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/dynamodb.rs#L584-L620","documentation":"Wraps an AWS SDK BatchWriteItem failure from the DynamoDB sink during a chunk write. The `Err` arm means the batch write request itself failed at the transport/service level (e.g. network error, throttling returning an Err rather than unprocessed items), not that individual items were rejected. The sink deliberately retries unprocessed items; this error is for hard request failures.","triggerScenarios":"Calling write_chunk on the DynamoDB sink when the SDK batch_write_item call returns Err: AWS credentials invalid/expired, table not found or missing permissions, network outage, or the table exceeding provisioned throughput.","commonSituations":"IAM policy lacking dynamodb:BatchWriteItem on the target table; wrong region/endpoint in the connection properties; DynamoDB table deleted or renamed while the sink is running; sustained throughput throttling.","solutions":["Check the wrapped AWS SDK error (`anyhow` context) for the underlying cause (AccessDenied, ResourceNotFound, throttling) and fix IAM credentials/policy accordingly.","Verify the table name and region in the sink's WITH options (e.g. connection.region, endpoint).","Confirm network/egress connectivity from the RisingWave node to DynamoDB endpoints.","Increase table capacity or use on-demand mode if throttling is the cause."],"exampleFix":"// before\nWITH (\n  'connector' = 'dynamodb',\n  'table' = 'my-table'\n)\n// after\nWITH (\n  'connector' = 'dynamodb',\n  'table' = 'my-table',\n  aws.region = 'us-east-1',\n  aws.credentials.access_key_id = '...',\n  aws.credentials.secret_access_key = '...'\n)","handlingStrategy":"retry","validationCode":"aws sts get-caller-identity && aws dynamodb describe-table --table-name my-table --region us-east-1","typeGuard":null,"tryCatchPattern":"// risingwave handles this internally; on failure inspect the wrapped AWS SDK error in logs and resume the sink after fixing IAM/network\nmatch sink_error { SinkError::DynamoDb(e) => log::error!(\"aws cause: {:?}\", e.source()), _ => {} }","preventionTips":["Grant dynamodb:BatchWriteItem on the exact table ARN to the sink's IAM role.","Use on-demand capacity mode for unpredictable write volumes.","Set explicit aws.region in the sink options and test connectivity before creating the sink."],"tags":["dynamodb","aws","sink","write-failure"],"backgroundTag":"database-write-failed","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}