graphify icon indicating copy to clipboard operation
graphify copied to clipboard

`cluster-only` skips labeling batch on JSON parse error without retry or chunk split (inconsistent with `extract`)

Open sub4biz opened this issue 5 months ago • 1 comments

Version

0.8.38

Steps to reproduce

Run cluster-only on a large graph (e.g. 121k nodes, 135 labeling batches):

graphify cluster-only <path>

What happened

During community labeling, one batch failed with a JSON parse error:

[graphify label] batch N/M failed:
Expecting property name enclosed in double quotes: line 8 column 40 (char 242)

The error is logged but the batch is skipped without retry or chunk split. The final output says "Done" without indicating that some batches failed.

Expected behavior

extract already handles this case correctly - when the LLM returns invalid JSON, it splits the chunk into halves and retries:

[graphify] LLM returned invalid JSON, skipping chunk (first 200 chars: ...)
[graphify] chunk of 10 truncated at depth 0, splitting into halves of 5 and 5

cluster-only labeling should apply the same split-and-retry logic for consistency and to avoid silently incomplete community names.

Suggested fix

Reuse the existing invalid-JSON handler from the extract path in the label/cluster-only labeling loop.

Environment

  • OS: Windows 11
  • graphify: 0.8.38
  • Install method: uv tool install graphifyy[gemini]
  • Graph size: 121,500 nodes, 13,409 communities, 135 labeling batches

sub4biz avatar Jun 12 '26 02:06 sub4biz

Fixed by #1380 (commit ab1e0ec on v8): community labeling now splits a malformed-JSON batch and retries each half, mirroring the extract path, instead of silently dropping ~100 names per failed batch.

safishamsi avatar Jun 18 '26 21:06 safishamsi