{"record":{"id":"4a4d6967a53d831f","repo":"chroma-core/chroma","slug":"not-regex-requires-a-string-pattern-got-type-va","errorCode":null,"errorMessage":"$not_regex requires a string pattern, got {type(value).__name__}","messagePattern":"\\$not_regex requires a string pattern, got (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"chromadb/execution/expression/operator.py","lineNumber":207,"sourceCode":"                        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(\n                            f\"$not_regex requires a string pattern, got {type(value).__name__}\"\n                        )\n                    return Key(field).not_regex(value)\n                else:\n                    raise ValueError(f\"Unknown operator: {op}\")\n            else:\n                # Direct value is shorthand for equality\n                return Key(field) == condition\n\n    def __and__(self, other: \"Where\") -> \"And\":\n        \"\"\"Overload & operator for AND\"\"\"\n        # If self is already an And, extend it\n        if isinstance(self, And):\n            # If other is also And, combine all conditions\n            if isinstance(other, And):\n                return And(self.conditions + other.conditions)\n            return And(self.conditions + [other])\n        # If other is And, prepend self to it","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/execution/expression/operator.py#L189-L225","documentation":"Raised by Where.from_dict when the '$not_regex' operator's value is not a string. The negated regex filter accepts only a string pattern, so any other type (compiled pattern, number, etc.) is rejected.","triggerScenarios":"Thrown at chromadb/execution/expression/operator.py:207 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a regex pattern string: {\"field\": {\"$not_regex\": \"^pattern\"}}","Ensure the value was not accidentally wrapped in a list or dict"],"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"}