Skip to content

[Bug]: Semantic cache — RediSearch vector search fails ("Syntax error") for TAG values containing ":" (escapeSearchValue omits ":" and other special chars) #5333

Closed

Description

@mann1x

Prerequisites

  • I have searched existing issues and discussions to avoid duplicates
  • I am using the latest version (or have tested against main/nightly)

Description

When the semantic cache runs a vector search and a metadata TAG filter value contains a colon : — e.g. the model name (cache_by_model: true) for Ollama/vLLM names like gemma31b-q6:latest — the FT.SEARCH is rejected and the plugin logs semantic search skipped. Semantic matching then silently never fires; every request falls through and is stored fresh. Direct (hash) caching still works, so it's easy to miss.

Root cause: framework/vectorstore/redis.go → escapeSearchValue() escapes a subset of RediSearch specials but omits : (and ; / < > = + ).
For a TAG query @field:{value} at DIALECT 2, an unescaped : is a syntax error.

Model IDs commonly contain : (:latest, :q6_K) and / (provider-prefixed).

Steps to reproduce

FT.CREATE testidx PREFIX 1 td: SCHEMA model TAG
HSET td:1 model "gemma31b-q6:latest"
FT.SEARCH testidx "@model:{gemma31b-q6:latest}" DIALECT 2 # current output -> Syntax error near gemma31b-q6
FT.SEARCH testidx "@model:{gemma31b-q6:latest}" DIALECT 2 # colon escaped -> 1) td:1 (works)

Expected behavior

semantic search runs; similar prompt returns a cached (semantic) hit.

Actual behavior

native vector search failed: Syntax error at offset N near ; semantic search skipped; never a semantic hit for such model/tag values.

Affected area(s)

Framework

Version

framework v1.5.1 (built from source @ c0909f9; gateway ~v2.1.28)

Environment

- OS:              Ubuntu 24.04.4 LTS · Linux x86_64 · kernel 6.8.0-111-generic
- Go toolchain:    1.26.4  (build image golang:1.26.4-alpine3.23)
- Node:            25      (UI build image node:25-alpine3.23)
- Bifrost:         self-hosted OSS, built from source at commit c0909f9
- Vector store:    Redis 7.4.7 + RediSearch 2.10.20
                   (redis/redis-stack-server:latest), query DIALECT 2
- Deployment:      Docker, --network host, source_of_truth: split
- Embedding:       local OpenAI-compatible endpoint (Qwen3-Embedding-0.6B llamafile)

Relevant logs/output

Regression?

No response

Severity

Medium (some functionality impaired)

Activity

  1. AdityaPainuli commented on Jul 18, 2026

    @AdityaPainuli
    Contributor

    Hi @mann1x, reproduced this issue and opened a PR for it.
    Replaced the blocklist with an allowlist. Every ASCII char that isn't alphanumeric or underscore gets escaped; non-ASCII passes through. No list to keep in sync with RedisSearch's grammar anymore.

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