{"record":{"id":"4b5987248c17271f","repo":"apache/seatunnel","slug":"graph-operation-failed","errorCode":"GRAPH_OPERATION_FAILED","errorMessage":"Failed to write vertex batch","messagePattern":"Failed to write vertex batch","errorType":"error_code","errorClass":"HugeGraphConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/buffer/BatchBuffer.java","lineNumber":207,"sourceCode":"        }\n    }\n\n    private void flushVertexGroup(\n            List<GraphElementEnvelope> batch, Map<String, UpdateStrategy> updateStrategies) {\n        try {\n            List<Vertex> vertices =\n                    batch.stream()\n                            .map(env -> (Vertex) env.getElement())\n                            .collect(Collectors.toList());\n            if (updateStrategies.isEmpty()) {\n                client.batchWriteVertices(vertices);\n            } else {\n                client.batchUpdateVertices(vertices, updateStrategies);\n            }\n        } catch (Exception e) {\n            if (!batchFailureFallback) {\n                logBatchFailure(batch, e);\n                throw new HugeGraphConnectorException(\n                        HugeGraphConnectorErrorCode.GRAPH_OPERATION_FAILED,\n                        \"Failed to write vertex batch\",\n                        e);\n            }\n            fallbackInsertSingly(batch, e);\n        }\n    }\n\n    private void doFlushEdges() {\n        if (edgeBuffer.isEmpty()) {\n            return;\n        }\n        List<GraphElementEnvelope> batch = new ArrayList<>(edgeBuffer);\n        edgeBuffer.clear();\n        for (Map.Entry<Map<String, UpdateStrategy>, List<GraphElementEnvelope>> group :\n                groupByStrategy(batch).entrySet()) {\n            flushEdgeGroup(group.getValue(), group.getKey());\n        }","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/buffer/BatchBuffer.java#L189-L225","documentation":"flushVertexGroup submits a batch of vertices to HugeGraph via batchUpdateVertices/batchInsertVertices. When the HugeClient call throws and batch failure fallback is disabled, the error is wrapped as GRAPH_OPERATION_FAILED with 'Failed to write vertex batch', failing the whole batch.","triggerScenarios":"HugeGraph server rejects or errors on a vertex batch write (schema violation, missing vertex label, server timeout, connection drop) while batch_failure_fallback is false.","commonSituations":"Vertex label or property keys not created in schema; batch size exceeding server limits; HugeGraph under load causing timeouts; network interruption between SeaTunnel worker and HugeGraph.","solutions":["Read the underlying cause (logBatchFailure output) to find the server-side reason.","Enable batch_failure_fallback=true so the batch is retried record-by-record instead of failing.","Ensure the schema (vertex labels, property keys, indexes) exists in HugeGraph before running the job.","Reduce batch_size and increase timeouts if the server rejects oversized/slow batches."],"exampleFix":"// before\nHugeGraph {\n  batch_size = 500\n}\n// after\nHugeGraph {\n  batch_size = 100\n  batch_failure_fallback = true\n}","handlingStrategy":"fallback","validationCode":"// pre-flight: ensure labels exist\nMap<String,Object> schema = hugeGraphClient.getSchema();\n// verify vertex label of each element exists before flushing","typeGuard":null,"tryCatchPattern":"try {\n    flushVertexGroup(batch);\n} catch (HugeGraphConnectorException e) {\n    if (e.getErrorCode() == HugeGraphConnectorErrorCode.GRAPH_OPERATION_FAILED) {\n        LOG.error(\"vertex batch failed; cause: {}\", e.getCause(), e); // read cause for server reason\n    }\n    throw e;\n}","preventionTips":["Create schema (labels, property keys) before running the job.","Enable batch_failure_fallback for dirty-data tolerance.","Keep batch_size modest (100-500) and tune server timeouts."],"tags":["hugegraph","batch-write","server-error"],"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"}