{"record":{"id":"e7ebef0814eef17e","repo":"apache/seatunnel","slug":"graph-operation-failed-e7ebef","errorCode":"GRAPH_OPERATION_FAILED","errorMessage":"Non-idempotent write failed (not retried to avoid duplicates): ${e.getMessage()}","messagePattern":"Non-idempotent write failed \\(not retried to avoid duplicates\\): (.+?)","errorType":"error_code","errorClass":"HugeGraphConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java","lineNumber":211,"sourceCode":"     * createIfNotExist=true) and DELETE (removeVertex/removeEdge). Idempotent operations are\n     * retried on retryable errors because a second attempt cannot create duplicates.\n     */\n    private void executeIdempotentWrite(GraphOperation operation) {\n        executeGraphOperation(operation, true);\n    }\n\n    /**\n     * Executes a write operation that is NOT safe to retry: plain INSERT (addVertex/addVertices/\n     * addEdge/addEdges). A retry after a server-committed-but-client-timed-out response would\n     * create a duplicate element. Non-idempotent writes fail fast — the caller's single-record\n     * fallback handles them individually instead.\n     */\n    private void executeNonIdempotentWrite(GraphOperation operation) {\n        try {\n            ensureClientInitialized();\n            operation.execute(this.client.graph());\n        } catch (ServerException | ClientException e) {\n            throw new HugeGraphConnectorException(\n                    HugeGraphConnectorErrorCode.GRAPH_OPERATION_FAILED,\n                    \"Non-idempotent write failed (not retried to avoid duplicates): \"\n                            + e.getMessage(),\n                    e);\n        }\n    }\n\n    /**\n     * Executes a graph write with optional retry. When {@code idempotent} is true, retryable server\n     * errors (status &ge; 500, 408, 425, 429) are retried up to {@code maxRetries} times with\n     * exponential backoff. When false, the operation is attempted once — if it fails the exception\n     * propagates immediately so the caller can route through the single-record fallback or skip the\n     * record.\n     */\n    private void executeGraphOperation(GraphOperation operation, boolean idempotent) {\n        int totalAttempts = idempotent ? this.maxRetries + 1 : 1;\n        for (int attempt = 1; attempt <= totalAttempts; attempt++) {\n            try {","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java#L193-L229","documentation":"executeNonIdempotentWrite runs insert operations that are not safe to retry (plain inserts could duplicate data). On ServerException or ClientException it immediately throws GRAPH_OPERATION_FAILED without retrying, to avoid duplicate writes.","triggerScenarios":"writeVertex, writeEdge, batchWriteVertices, or batchWriteEdges hits a server/client exception during a non-idempotent insert (e.g., duplicate id with IF_ABSENT absent, schema violation, server error).","commonSituations":"Inserting a vertex/edge id that already exists; transient server errors that in this path are deliberately not retried; malformed element exceeding property constraints.","solutions":["Read the wrapped e.getMessage() to determine if it is a duplicate-id or schema error.","Use update strategies / idempotent write mode (e.g., create_if_absent/update_if_present) if re-submission is needed.","Pre-check existence or deduplicate records upstream to avoid duplicate-insert rejections.","Ensure schema constraints match the data being written."],"exampleFix":"// before\n// plain insert, fails on duplicates\nclient.writeVertex(vertex);\n// after\n// use update strategies so re-execution is idempotent\nclient.batchUpdateVertices(vertices, updateStrategies);","handlingStrategy":"validation","validationCode":"// deduplicate by id before writing non-idempotent inserts\nCollection<Vertex> unique = records.stream()\n    .collect(Collectors.toMap(Vertex::id, v -> v, (a, b) -> b)).values();","typeGuard":null,"tryCatchPattern":"try {\n    executeNonIdempotentWrite(op); // via connector sink\n} catch (HugeGraphConnectorException e) {\n    LOG.error(\"non-idempotent write failed, NOT retried: {}\", e.getMessage(), e);\n    throw e; // retrying here would duplicate data\n}","preventionTips":["Prefer idempotent writes (update strategies) when replay is possible.","Deduplicate records by element id before inserting.","Never blind-retry these operations."],"tags":["hugegraph","write","idempotency","no-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"}