Skip to content

[Bug] module_deps query fails with KeyError 'imported_by_files' #757

@qwertist

Description

@qwertist

Description

The module_deps query type in analyze_code_relationships fails with a Python KeyError on v0.3.1 with KùzuDB backend.

Steps to Reproduce

pip install codegraphcontext==0.3.1
cgc index /path/to/any/project

Then via MCP:

codegraph_analyze_code_relationships(query_type="module_deps", target="any_module.js")

Expected Behavior

Module dependency information (imports/imported-by) should be returned.

Actual Behavior

{
  "error": "Error executing relationship query: 'imported_by_files'",
  "query_type": "module_deps",
  "target": "any_module.js"
}

Root Cause Analysis

This appears to be a Python KeyError — the code tries to access a key 'imported_by_files' from a dictionary result, but that key doesn't exist. This is different from the list_extract issue (#756) — it's a bug in the Python handler for module_deps, not a Cypher compatibility issue.

Environment

  • codegraphcontext: 0.3.1
  • Database backend: KùzuDB (default)
  • Python: 3.12.3
  • OS: Linux (Ubuntu)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions