{"record":{"id":"c12ac4171093d28e","repo":"apache/seatunnel","slug":"flush-data-failed-c12ac4","errorCode":"FLUSH_DATA_FAILED","errorMessage":"Writing records to InfluxDB failed.","messagePattern":"Writing records to InfluxDB failed\\.","errorType":"error_code","errorClass":"InfluxdbConnectorException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-influxdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/influxdb/sink/InfluxDBSinkWriter.java","lineNumber":118,"sourceCode":"        if (sinkConfig.getBatchSize() > 0 && batchList.size() >= sinkConfig.getBatchSize()) {\n            flush();\n        }\n    }\n\n    public void flush() throws IOException {\n        checkFlushException();\n        if (batchList.isEmpty()) {\n            return;\n        }\n        BatchPoints.Builder batchPoints = BatchPoints.database(sinkConfig.getDatabase());\n        for (int i = 0; i <= sinkConfig.getMaxRetries(); i++) {\n            try {\n                batchPoints.points(batchList);\n                influxdb.write(batchPoints.build());\n            } catch (Exception e) {\n                log.error(\"Writing records to influxdb failed, retry times = {}\", i, e);\n                if (i >= sinkConfig.getMaxRetries()) {\n                    throw new InfluxdbConnectorException(\n                            CommonErrorCodeDeprecated.FLUSH_DATA_FAILED,\n                            \"Writing records to InfluxDB failed.\",\n                            e);\n                }\n\n                try {\n                    long backoff =\n                            Math.min(\n                                    sinkConfig.getRetryBackoffMultiplierMs() * i,\n                                    sinkConfig.getMaxRetryBackoffMs());\n                    Thread.sleep(backoff);\n                } catch (InterruptedException ex) {\n                    Thread.currentThread().interrupt();\n                    throw new InfluxdbConnectorException(\n                            CommonErrorCodeDeprecated.FLUSH_DATA_FAILED,\n                            \"Unable to flush; interrupted while doing another attempt.\",\n                            e);\n                }","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-influxdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/influxdb/sink/InfluxDBSinkWriter.java#L100-L136","documentation":"InfluxDBSinkWriter.flush batches accumulated points and writes them via influxdb.write(batchPoints.build()). If the write throws and the retry loop has already exhausted sinkConfig.getMaxRetries(), it throws InfluxdbConnectorException with code FLUSH_DATA_FAILED and message 'Writing records to InfluxDB failed.' with the original exception as cause.","triggerScenarios":"Any exception on influxdb.write() that persists across all configured retries: connection drops to the InfluxDB server, write endpoint errors (400 bad points, 429 rate limit, 500/503), auth failures, or points that violate field-type consistency for the measurement.","commonSituations":"InfluxDB restarted or under load mid-job; conflicting field types written to the same measurement (InfluxDB rejects type conflicts); batch too large for the server; network interruption; write privileges revoked (403).","solutions":["Inspect the cause chain (the wrapped exception) for the real HTTP error and fix accordingly","Increase maxRetries / retryBackoffMultiplierMs / maxRetryBackoffMs in the sink config for transient issues","Resolve write conflicts: ensure consistent field types per measurement and series in the schema","Check InfluxDB server health, retention policy existence, and user write permissions","Reduce batch size if payloads are too large for the server"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-flight: server reachable and writable\nif (!influxdb.ping().isGood()) throw new IllegalStateException(\"InfluxDB not reachable\");\ninfluxdb.version(); // triggers auth check; throws on 401","typeGuard":null,"tryCatchPattern":"try {\n    sinkWriter.flush();\n} catch (InfluxdbConnectorException e) {\n    if (String.valueOf(e.getCode()).contains(\"FLUSH_DATA_FAILED\")) {\n        log.error(\"Flush failed after all retries; root cause: \", e.getCause());\n        // alert / restart writer\n    }\n    throw e;\n}","preventionTips":["Always inspect getCause() — the message is generic but the cause holds the real HTTP error","Tune maxRetries/retryBackoffMultiplierMs/maxRetryBackoffMs for transient outages","Keep field types consistent per measurement to avoid InfluxDB write conflicts","Monitor InfluxDB health and rate limits (429) during heavy write jobs"],"tags":["influxdb","sink","flush","retry","write"],"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"}