Skip to content

Bug: 'cgc watch' incremental indexing failing with "AttributeError: 'NoneType' object has no attribute 'split'" #1272

Closed

Description

@gojun077

Hi, team cgc! I'm using main branch commit c235df7 and when cgc watch is observing a repo for file changes, when changes are detected in multiple files, all threads are failing with errors similar to the following:

...
Exception in thread Thread-145:
Traceback (most recent call last):
  File "/Users/peter.junkoh/.pyenv/versions/3.14.4/lib/python3.14/threading.py", line 1082, in _bootstrap_inner
    self._context.run(self.run)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/peter.junkoh/.pyenv/versions/3.14.4/lib/python3.14/threading.py", line 1385, in run
    self.function(*self.args, **self.kwargs)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/peter.junkoh/Documents/repos/personal/CodeGraphContext/src/codegraphcontext/core/watcher.py", line 310, in <lambda>
    self._debounce(event.src_path, lambda: self._handle_modification(event.src_path))
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/Users/peter.junkoh/Documents/repos/personal/CodeGraphContext/src/codegraphcontext/core/watcher.py", line 264, in _handle_modification
    self.graph_builder.link_inheritance(subset_file_data, self.imports_map)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/peter.junkoh/Documents/repos/personal/CodeGraphContext/src/codegraphcontext/tools/graph_builder.py", line 854, in link_inheritance
    self._writer.write_decorated_by_links(build_decorated_by_links(all_file_data, imports_map))
                                          ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/peter.junkoh/Documents/repos/personal/CodeGraphContext/src/codegraphcontext/tools/indexing/resolution/inheritance.py", line 365, in build_decorated_by_links
    dec_path = _resolve_decorator_path(
        dec_name, caller_file_path, local_names, local_imports, imports_map
    )
  File "/Users/peter.junkoh/Documents/repos/personal/CodeGraphContext/src/codegraphcontext/tools/indexing/resolution/inheritance.py", line 323, in _resolve_decorator_path
    lookup = imported.split(".")[-1]
             ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

Environment:

  • MacOS 26.5.1 Tahoe
  • Apple Silicon M4 (MBP)
  • Built cgc from source

Activity

  1. github-actions commented on Jun 17, 2026

    @github-actions
    Contributor

    Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

  2. Akshitha2912v commented on Jun 17, 2026

    @Akshitha2912v

    Hi, I would like to work on this issue under GSSoC 2026. Please assign it to me.

    Thank you!

  3. moved this from Backlog tasks to In progress in CGC Progress Boardon Jun 20, 2026
  4. MorningStar0709 commented on Jun 20, 2026

    @MorningStar0709
    Contributor

    Hi @PeterJunker, I've opened PR #1291 which addresses this issue.

    Root cause: Several dict comprehensions that build local_imports call .split() or .endswith() on imp["name"] without checking for None. When tree-sitter parsers produce import entries with "name": None (e.g., certain relative/star/aliased import forms), this crashes with AttributeError.

    Fix summary:

    • Added imp.get("name") guards to all affected dict comprehensions in graph_builder.py, inheritance.py, and calls.py
    • Guarded _resolve_decorator_path against None imported values with fall-through to imports_map lookup
    • Added full_import_name fallback for decorator/metaclass resolution (Python imports have full_import_name but not source)

    The fix also covers the related issue #1285 (decorator path crash).

  5. Shashankss1205 commented on Jul 25, 2026

    @Shashankss1205
    Collaborator

    Resolved: the watcher incremental-parse NoneType.split() crash is fixed by import-name/source guards (commits 59d9172, 62dae1e). Closing.

  6. moved this from In progress to Done in CGC Progress Boardon Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions