{"record":{"id":"a0d14b4a91a1f4ef","repo":"redis/redis-py","slug":"input-should-be-provided","errorCode":null,"errorMessage":"'input' should be provided","messagePattern":"'input' should be provided","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/vectorset/commands.py","lineNumber":253,"sourceCode":"        ``ef`` sets the exploration factor.\n\n        ``filter`` sets the filter that should be applied for the search.\n\n        ``filter_ef`` sets the max filtering effort.\n\n        ``truth`` when enabled, forces the command to perform a linear scan.\n\n        ``no_thread`` when enabled forces the command to execute the search\n                on the data structure in the main thread.\n\n        ``epsilon`` floating point between 0 and 1, if specified will return\n                only elements with distance no further than the specified one.\n\n        For more information, see https://redis.io/commands/vsim.\n        \"\"\"\n\n        if not input:\n            raise DataError(\"'input' should be provided\")\n\n        pieces = []\n        options = {}\n\n        if isinstance(input, bytes):\n            pieces.extend([\"FP32\", input])\n        elif isinstance(input, list):\n            pieces.extend([\"VALUES\", len(input)])\n            pieces.extend(input)\n        else:\n            pieces.extend([\"ELE\", input])\n\n        if with_scores or with_attribs:\n            if check_protocol_version(get_protocol_version(self.client), 3):\n                options[CallbacksOptions.RESP3.value] = True\n\n            if with_scores:\n                pieces.append(\"WITHSCORES\")","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/vectorset/commands.py#L235-L271","documentation":"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.","triggerScenarios":"Calling client.vsim(key, input=[]) or input='' or input=None. Note truthiness check: empty list, empty bytes, and empty string all trigger it.","commonSituations":"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.","solutions":["Pass a non-empty list[float], non-empty bytes, or non-empty element string.","Validate the embedding output length before calling vsim.","Guard at the call site: if not input: return [] / raise upstream."],"exampleFix":"// before\nclient.vsim(key, input=query_vector)  # query_vector == []\n// after\nif query_vector:\n    results = client.vsim(key, input=query_vector)\nelse:\n    results = []","handlingStrategy":"validation","validationCode":"if not input:\n    raise ValueError('vsim input is empty')\nclient.vsim(key, input=input)","typeGuard":"def is_valid_vsim_input(input) -> bool:\n    if isinstance(input, (list, bytes, str)):\n        return len(input) > 0\n    return bool(input)","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    results = client.vsim(key, input=input)\nexcept DataError:\n    results = []","preventionTips":["Check embedding model output length before querying.","Treat empty input as a no-op rather than sending it."],"tags":["vectorset","vsim","argument-validation"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}