{"record":{"id":"bd78f2aad954bb03","repo":"chroma-core/chroma","slug":"contains-requires-a-str-int-float-or-bool-got","errorCode":null,"errorMessage":"$contains requires a str, int, float, or bool, got {type(value).__name__}","messagePattern":"\\$contains requires a str, int, float, or bool, got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"chromadb/execution/expression/operator.py","lineNumber":189,"sourceCode":"                elif op == \"$lt\":\n                    return Key(field) < value\n                elif op == \"$lte\":\n                    return Key(field) <= value\n                elif op == \"$in\":\n                    if not isinstance(value, list):\n                        raise TypeError(\n                            f\"$in requires a list, got {type(value).__name__}\"\n                        )\n                    return Key(field).is_in(value)\n                elif op == \"$nin\":\n                    if not isinstance(value, list):\n                        raise TypeError(\n                            f\"$nin requires a list, got {type(value).__name__}\"\n                        )\n                    return Key(field).not_in(value)\n                elif op == \"$contains\":\n                    if not isinstance(value, (str, int, float, bool)):\n                        raise TypeError(\n                            f\"$contains requires a str, int, float, or bool, got {type(value).__name__}\"\n                        )\n                    return Key(field).contains(value)\n                elif op == \"$not_contains\":\n                    if not isinstance(value, (str, int, float, bool)):\n                        raise TypeError(\n                            f\"$not_contains requires a str, int, float, or bool, got {type(value).__name__}\"\n                        )\n                    return Key(field).not_contains(value)\n                elif op == \"$regex\":\n                    if not isinstance(value, str):\n                        raise TypeError(\n                            f\"$regex requires a string pattern, got {type(value).__name__}\"\n                        )\n                    return Key(field).regex(value)\n                elif op == \"$not_regex\":\n                    if not isinstance(value, str):\n                        raise TypeError(","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/execution/expression/operator.py#L171-L207","documentation":"Raised by Where.from_dict when the '$contains' operator's value is not one of the supported scalar types (str, int, float, bool) — e.g. a list, dict, or None was passed as the containment value for the field.","triggerScenarios":"Thrown at chromadb/execution/expression/operator.py:189 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a scalar value: {\"field\": {\"$contains\": \"text\"}} or {\"$contains\": 42}","Use $in for list-membership checks instead of $contains"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","contentChangedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}