Skip to content

FalkorDB: empty fulltext query crashes with RediSearch syntax error when all query words are stopwords #1337

@gboston

Description

@gboston

Problem

When build_fulltext_query in falkordb_driver.py receives a query where all words are filtered out as stopwords, sanitized_query becomes an empty string. The method still constructs the full query string, producing:

(@group_id:"standups") ()

The trailing () is invalid RediSearch syntax and causes FalkorDB to throw:

RediSearch: Syntax error at offset 24 near standups

This error surfaces during graphiti.add_episode() when graphiti internally searches for existing nodes to merge with, and the extracted entity name consists entirely of stopwords.

Steps to reproduce

  1. Use a FalkorDB-backed Graphiti instance with a group_id set (e.g. "standups")
  2. Ingest an episode where the LLM extracts an entity whose name is composed entirely of RediSearch stopwords
  3. Graphiti calls build_fulltext_query with that entity name — all words are stripped, sanitized_query = ""
  4. The method constructs "(@group_id:\"standups\") ()" and passes it to FalkorDB
  5. FalkorDB raises a syntax error

Fix

Add a guard for the empty-query case before constructing full_query:

if not sanitized_query:
    return ''

Insert this before the existing max_query_length check in build_fulltext_query (~line 419 in falkordb_driver.py).

Version

  • graphiti-core: 0.28.2
  • FalkorDB driver

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