Skip to content

CLI query mode returns empty results despite successful indexing #115

@jsyrjala

Description

@jsyrjala

Summary

All graph query tools (get_architecture, search_graph, get_graph_schema, get_code_snippet) return empty results when used via CLI mode, even though indexing succeeds and list_projects shows correct node/edge counts.

Reproduction

# 1. Index succeeds — 3174 nodes, 8682 edges
codebase-memory-mcp cli index_repository '{"repo_path": "/path/to/project"}'
# Output: {"project":"...","status":"indexed","nodes":3174,"edges":8682}

# 2. list_projects confirms data exists
codebase-memory-mcp cli list_projects '{}'
# Output: {"projects":[{"name":"...","nodes":3174,"edges":8682,"size_bytes":10420224}]}

# 3. All queries return empty
codebase-memory-mcp cli get_architecture '{"repo_path": "/path/to/project", "aspects": ["all"]}'
# Output: {"total_nodes":0,"total_edges":0,"node_labels":[],"edge_types":[]}

codebase-memory-mcp cli search_graph '{"repo_path": "/path/to/project", "label": "Function", "name_pattern": "Finalize"}'
# Output: {"total":0,"results":[],"has_more":false}

codebase-memory-mcp cli get_graph_schema '{"repo_path": "/path/to/project"}'
# Output: {"node_labels":[],"edge_types":[]}

Environment

  • OS: macOS (Apple Silicon)
  • Binary: codebase-memory-mcp installed at ~/.local/bin/
  • Also configured as MCP server in ~/.claude/.mcp.json

Analysis

list_projects works because it reads metadata, not the graph. The graph DB handle appears not to be opened for reads in CLI query mode — only the metadata store is accessible. Indexing writes succeed, suggesting the graph DB is created correctly but not reconnected for subsequent CLI invocations.

This may be a session/connection lifecycle issue where the CLI opens the DB for writes during indexing but doesn't reopen it for read queries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions