redis/redis-py · error · DataError

'input' should be provided

Error message

'input' should be provided

What it means

Raised by VectorSetCommands.vsim when the input argument is falsy. input can be a list of floats, raw bytes, or an existing element name (string); an empty list, empty bytes, or empty string is rejected because there is nothing to compare against. The check is 'not input'.

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 da03cdc7e8)

Solutions

  1. Provide a non-empty vector list, non-empty bytes, or a non-empty element name.
  2. Guard the call: if input: client.vsim('set', input).
  3. Fix the upstream embedding/identifier source so it never yields empty.

Example fix

// before
client.vsim('set', query_vec)  # query_vec == []
// after
if query_vec:
    client.vsim('set', query_vec)
Defensive patterns

Strategy: validation

Validate before calling

def safe_vsim(client, key, input, **kw):
    if not input:
        return None
    return client.vsim(key, input, **kw)

Type guard

def vsim_input_valid(input) -> bool:
    return bool(input)

Try / catch

try:
    client.vsim('set', inp)
except Exception as e:
    if "'input' should be provided" in str(e):
        return None
    raise

Prevention

When it happens

Trigger: client.vsim('set', []) (empty vector list), client.vsim('set', b'') (empty bytes), or client.vsim('set', '') (empty element name). Common when the input vector came from a failed embedding call or the element name was blank.

Common situations: Embedding model returned an empty vector for empty/whitespace query text; element-based lookup with a missing identifier; passing a query vector variable that was never populated.

Related errors


AI-assisted analysis of redis/redis-py@da03cdc7e8 (2026-08-04). Data as JSON: /data/errors/a0d14b4a91a1f4ef.json. Report an issue: GitHub.