Skip to content

Fix Python graph builder crash: NoneType split during relationship resolution - #1335

Merged
Shashankss1205 merged 2 commits into
CodeGraphContext:mainfrom
alanhuu1990:fix/python-graph-builder-none-split
Jul 4, 2026
Merged

Shashankss1205 merged 2 commits into
CodeGraphContext:mainfrom
alanhuu1990:fix/python-graph-builder-none-split

Conversation

@alanhuu1990

Copy link
Copy Markdown
Contributor

Description

Fixes issue #1334 where the Python graph builder crashes with 'NoneType' object has no attribute 'split' during post-parse relationship resolution.

Root Cause

_get_node_text() in tools/languages/python.py returns None instead of "" when a node's text is unavailable. This None propagates into the bases list in _find_classes(), then into inheritance resolution code.

Changes

  1. tools/languages/python.py — _get_node_text() now returns "" instead of None when node text is unavailable
  2. tools/indexing/resolution/inheritance.py — Added guard in resolve_inheritance_link() for None base_class_str before .split()
  3. tools/indexing/resolution/inheritance.py — Added guard in build_embeds_links() for None entries in bases list

Testing

  • Wrote and ran direct unit tests on all 3 guards
  • Cleared old KuzuDB index and re-indexed a 277-file Python project — no crash, indexing completes successfully
  • codegraphcontext stats shows correct file/function/class counts
  • Caller graph edges now populate correctly

Fixes #1334

…#1334)

Three crash sites fixed:
- tools/languages/python.py: _get_node_text() returns '' instead of None
- tools/indexing/resolution/inheritance.py: guard .split() calls in
  resolve_inheritance_link() when base_class_str is None
- tools/indexing/resolution/inheritance.py: guard .split() in
  build_embeds_links() when base list entry is None

Fixes CodeGraphContext#1334
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@alanhuu1990 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel.

A member of the Team first needs to authorize it.

…ce.py, graph_builder.py)

Additional None-guard fixes discovered during full-index testing:
- inheritance.py:95 — guard imp['name'].split('.') via (imp.get('name') or '')
  + filter out imports with no name
- inheritance.py:326 — guard imported.split('.') when imported is None
- calls.py:1754,2145 — same guard as inheritance.py:95
- graph_builder.py:531 — same guard

Fixes CodeGraphContext#1334
@Shashankss1205
Shashankss1205 merged commit 8bd1a8f into CodeGraphContext:main Jul 4, 2026
1 check failed
@github-project-automation github-project-automation Bot moved this from Backlog tasks to Done in CGC Progress Board Jul 4, 2026
@Shashankss1205 Shashankss1205 added gssoc:approved GSSoC validation: counts toward scoring level:intermediate GSSoC difficulty: 35 pts contributor / 20 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:clean GSSoC quality: x1.2 contributor / +5 mentor type:bug GSSoC type bonus: bug labels Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC validation: counts toward scoring level:intermediate GSSoC difficulty: 35 pts contributor / 20 mentor mentor:Shashankss1205 GSSoC mentor attribution: credits reviewing mentor quality:clean GSSoC quality: x1.2 contributor / +5 mentor type:bug GSSoC type bonus: bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Python graph builder crashes with 'NoneType' object has no attribute 'split' during post-parse relationship resolution

2 participants