redis/redis-py · error · DataError

'input' should be provided

Error message

'input' should be provided

What it means

Raised by VSIM when the input argument is empty/falsy. input can be a vector (list[float] / FP32 bytes) or an element name (string) to compare against the set; an empty value is rejected client-side.

Solutions

  1. Pass a non-empty list[float], non-empty bytes, or non-empty element string.
  2. Validate the embedding output length before calling vsim.
  3. Guard at the call site: if not input: return [] / raise upstream.

Example fix

// before
client.vsim(key, input=query_vector)  # query_vector == []
// after
if query_vector:
    results = client.vsim(key, input=query_vector)
else:
    results = []
Defensive patterns

Strategy: validation

Validate before calling

if not input:
    raise ValueError('vsim input is empty')
client.vsim(key, input=input)

Type guard

def is_valid_vsim_input(input) -> bool:
    if isinstance(input, (list, bytes, str)):
        return len(input) > 0
    return bool(input)

Try / catch

from redis.exceptions import DataError
try:
    results = client.vsim(key, input=input)
except DataError:
    results = []

Prevention

When it happens

Trigger: Calling client.vsim(key, input=[]) or input='' or input=None. Note truthiness check: empty list, empty bytes, and empty string all trigger it.

Common situations: Query vector came from an embedding model that returned empty. Element name from user input that was blank. None passed where a vector was expected.

Related errors


AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10). Data as JSON: /api/errors/a0d14b4a91a1f4ef. Report an issue: GitHub.

Appendix: source

Thrown at redis/commands/vectorset/commands.py:253

        ``ef`` sets the exploration factor.

        ``filter`` sets the filter that should be applied for the search.

        ``filter_ef`` sets the max filtering effort.

        ``truth`` when enabled, forces the command to perform a linear scan.

        ``no_thread`` when enabled forces the command to execute the search
                on the data structure in the main thread.

        ``epsilon`` floating point between 0 and 1, if specified will return
                only elements with distance no further than the specified one.

        For more information, see https://redis.io/commands/vsim.
        """

        if not input:
            raise DataError("'input' should be provided")

        pieces = []
        options = {}

        if isinstance(input, bytes):
            pieces.extend(["FP32", input])
        elif isinstance(input, list):
            pieces.extend(["VALUES", len(input)])
            pieces.extend(input)
        else:
            pieces.extend(["ELE", input])

        if with_scores or with_attribs:
            if check_protocol_version(get_protocol_version(self.client), 3):
                options[CallbacksOptions.RESP3.value] = True

            if with_scores:
                pieces.append("WITHSCORES")

View on GitHub (pinned to 6a6b581b48)