{"record":{"id":"fa3c8e549ef8dc5c","repo":"apache/seatunnel","slug":"failed-to-write-d-items-to-table-s-after-d-retr","errorCode":null,"errorMessage":"Failed to write %d items to table %s after %d retries","messagePattern":"Failed to write (.+?) items to table (.+?) after (.+?) retries","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-amazondynamodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/amazondynamodb/sink/DynamoDbSinkClient.java","lineNumber":195,"sourceCode":"                        delay);\n\n                try {\n                    Thread.sleep(delay);\n                } catch (InterruptedException e) {\n                    Thread.currentThread().interrupt();\n                    throw new RuntimeException(\"Interrupted during retry\", e);\n                }\n            }\n        }\n\n        if (!pendingRequests.isEmpty()) {\n            log.error(\n                    \"Failed to write {} items to table '{}' after {} retries\",\n                    pendingRequests.size(),\n                    tableName,\n                    maxRetries);\n\n            throw new RuntimeException(\n                    String.format(\n                            \"Failed to write %d items to table %s after %d retries\",\n                            pendingRequests.size(), tableName, maxRetries));\n        }\n    }\n}\n","sourceCodeStart":177,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-amazondynamodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/amazondynamodb/sink/DynamoDbSinkClient.java#L177-L202","documentation":"DynamoDbSinkClient.flushWithRetry retries failed writes up to maxRetries; afterward, any still-pending (unprocessed or failed) WriteRequests cause this RuntimeException reporting the item count, table name, and retry count. It means the batch write permanently failed after exhausting retries.","triggerScenarios":"batchWriteItem repeatedly returns unprocessed items or errors (provisioned throughput exceeded, item size > 400KB, invalid items) across all maxRetries attempts, leaving pendingRequests non-empty at the end of flushWithRetry.","commonSituations":"DynamoDB table under-provisioned or in on-demand throttle due to hot partition keys; single items exceeding the 400KB DynamoDB limit; duplicate keys or invalid attribute values in the batch; sustained write rate above table capacity during bulk load.","solutions":["Increase DynamoDB write capacity (or use on-demand mode) / reduce sink parallelism and batch size to stay under throttling limits.","Increase maxRetries and backoff in the sink configuration for transient throttling.","Filter or split oversized items (>400KB) and fix invalid attribute values before writing.","Check the log lines just before the exception — they list the count and table; correlate with DynamoDB throttling metrics (ThrottledRequests, WriteThrottleEvents)."],"exampleFix":"// before\nmaxRetries = 3; batchSize = 25\n// after: more retries, smaller batches\nmaxRetries = 10; batchSize = 10","handlingStrategy":"retry","validationCode":"for (WriteRequest r : requests) {\n    if (r instanceof WriteRequest && estimatedSize(r) > 400 * 1024) throw new IllegalArgumentException(\"Item exceeds 400KB DynamoDB limit\");\n}","typeGuard":"null","tryCatchPattern":"try { client.flushWithRetry(); } catch (RuntimeException e) { log.error(\"DynamoDB flush failed: {}\", e.getMessage()); alertAndCheckpointReplay(); }","preventionTips":["Size the table capacity (or on-demand) for peak write throughput; watch WriteThrottleEvents metrics.","Keep batch size modest and items under 400KB.","Increase maxRetries with exponential backoff for throttling-prone workloads."],"tags":["java","dynamodb","write","retry"],"backgroundTag":"database-write-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}