Skip to content

Bug: repo_info endpoint missing graph_exists() check #580

Description

@gkorland

Description

The repo_info endpoint in api/index.py creates a Graph(repo) and calls g.stats() without first checking graph_exists(repo):

@app.route('/api/repo_info', methods=['POST'])
@public_access
@token_required
def repo_info():
    data = request.get_json()
    repo = data.get('repo')
    if repo is None:
        return jsonify({'status': 'Missing mandatory parameter "repo"'}), 400

    g = Graph(repo)        # No graph_exists() check
    stats = g.stats()
    info = get_repo_info(repo)
    ...

Other endpoints like graph_entities, get_neighbors, and find_paths all check graph_exists(repo) before proceeding.

Suggested Fix

Add the same guard:

if not graph_exists(repo):
    return jsonify({'status': f'Missing project {repo}'}), 400

Context

Found during code review of PR #522.

Activity

  1. JiwaniZakir commented on Apr 6, 2026

    @JiwaniZakir

    The inconsistency likely crept in when repo_info was added or refactored separately from the other endpoints, without the graph_exists() guard being treated as a required pattern. Without the check, Graph(repo) will instantiate a graph object against a non-existent graph, and g.stats() will either return meaningless/empty data or raise an exception depending on how the underlying FalkorDB client handles missing graphs — neither of which produces a clean 400 response to the caller. The fix is straightforward: add if not graph_exists(repo): return jsonify({'status': f'Missing project {repo}'}), 400 in api/index.py immediately after the repo is None guard in the repo_info function, consistent with how graph_entities, get_neighbors, and find_paths handle this case.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions