Repository navigation
Description
Summary
When importing LLM-extracted graph data, Commit2Graph.load_into_graph treats a single property value whose type does not match the schema's declared data_type as a whole-vertex failure: it logs "Property type/format 'age' is not correct, skip it & need check it again" and then continues, silently dropping the vertex. Any edge that references that vertex is then sent to the server with the local reference ("1:Sarah") as an endpoint id and fails with Server Exception: Invalid vertex id '1:Sarah'. The log message says "skip it" (the property) but the code drops the entire vertex — message and behavior disagree.
Reproduction (headless)
- Schema without
propertykeys(CheckSchemathen defaults every property toTEXT):personwithprimary_keys=["name"],properties=["name","age","occupation"],nullable_keys=["age","occupation"],id_strategy="PRIMARY_KEY"; edgeroommate(person→person, propertydate). - Extraction returns a person with
"age":30(JSON number — the demo prompt contract itself declaresageas INT) plus aroommateedge whoseoutV="1:Sarah". - Import:
age: 30(int) fails the TEXT check → Sarah's vertex is skipped →vid_mappinghas no"1:Sarah"→ the edge falls back to the raw id → server returnsInvalid vertex id '1:Sarah'.
The identical defect appears with a correct typed schema when an LLM returns age:"30" (string) for an INT property — numeric-string output is very common (see #185).
Proposed behavior
- Lossless coercion first. A helper coerces a value to the declared
data_type/cardinalitywhen lossless: numeric string ↔ number, number → text, scalar →[scalar]for LIST/SET (then each element), strictyyyy-MM-ddfor DATE. Unknown/un-coercible values are reported, never silently dropped. - Nullable property, un-coercible → drop just that property (warning) and keep creating the vertex.
- Primary-key / non-nullable property missing or un-coercible → skip that vertex with a reason, and skip the edges that reference it — both named in the summary.
- Edge endpoints: never call
addEdgewith an id that was not produced by a successfuladdVertex. - Raise only if no vertex could be imported at all (otherwise: partial import + clear summary).
Extended Scope
The same coercion and validation logic should ideally be applied to Edge properties, which are susceptible to the exact same LLM hallucination issues as Vertex properties. Furthermore, to prevent a single hallucinated entity from crashing a batch operation, PK mismatch should gracefully skip the entity rather than raising a fatal exception. Edge properties are currently passed to the server with no type check, and server CreateErrors are swallowed by _handle_graph_creation, so bad edges are silently lost today.
Observability
Vertices and edges should go through the same coercion + reporting helper so diagnostics are aligned. Collect dropped_properties / skipped_vertices / skipped_edges with per-item reasons (scope, item id, label, property, expected, actual, action), attach the summary to the import result, and surface it in the demo (related: #247).
Tests
The in-file FIXME at hugegraph-llm/src/tests/operators/hugegraph_op/test_commit_to_hugegraph_load_into_graph.py:29 already requests this coverage: vertex nullable/primary/collection/date branches, edge-property coercion, edge-skip when an endpoint is missing, and the aggregated summary. Unit tests use a mock client.
I can submit a PR with the fix and tests.
Activity
KHARSHAVARDHAN-eng commentedon Sep 16, 2026
Hi @kai-dong123 , I’d like to work on this issue.
I’ll investigate the current
Commit2Graph.load_into_graphflow, implement the proposed type-coercion and validation handling, ensure invalid vertices/edges are handled safely, and add the corresponding regression tests.I’ll start by reviewing the existing implementation and test coverage.
fix(llm): preserve edges and values and report skipped import elements