{"record":{"id":"b58676f53498ace4","repo":"chroma-core/chroma","slug":"resetting-is-not-allowed-by-this-configuration-to","errorCode":null,"errorMessage":"Resetting is not allowed by this configuration (to enable it, set `allow_reset` to `True` in your Settings() or include `ALLOW_RESET=TRUE` in your environment variables)","messagePattern":"Resetting is not allowed by this configuration \\(to enable it, set `allow_reset` to `True` in your Settings\\(\\) or include `ALLOW_RESET=TRUE` in your environment variables\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/config.py","lineNumber":479,"sourceCode":"        return sorter.static_order()\n\n    @override\n    def start(self) -> None:\n        super().start()\n        for component in self.components():\n            component.start()\n\n    @override\n    def stop(self) -> None:\n        super().stop()\n        for component in reversed(list(self.components())):\n            component.stop()\n\n    @override\n    def reset_state(self) -> None:\n        \"\"\"Reset the state of this system and all constituents in reverse dependency order\"\"\"\n        if not self.settings.allow_reset:\n            raise ValueError(\n                \"Resetting is not allowed by this configuration (to enable it, set `allow_reset` to `True` in your Settings() or include `ALLOW_RESET=TRUE` in your environment variables)\"\n            )\n        for component in reversed(list(self.components())):\n            component.reset_state()\n\n\nC = TypeVar(\"C\")\n\n\ndef get_class(fqn: str, type: Type[C]) -> Type[C]:\n    \"\"\"Given a fully qualifed class name, import the module and return the class\"\"\"\n    module_name, class_name = fqn.rsplit(\".\", 1)\n    module = importlib.import_module(module_name)\n    cls = getattr(module, class_name)\n    return cast(Type[C], cls)\n\n\ndef get_fqn(cls: Type[object]) -> str:","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/config.py#L461-L497","documentation":"System.reset_state() (chromadb/config.py) cascades a destructive reset to every component in reverse dependency order, but only after checking Settings.allow_reset, which defaults to False. The guard makes resets explicitly opt-in so a stray client.reset() cannot wipe a production deployment. The message tells you the two ways to opt in: the allow_reset setting or the ALLOW_RESET=TRUE env var.","triggerScenarios":"Calling chroma_client.reset() (which reaches System.reset_state) on a client built without Settings(allow_reset=True); test fixtures that reset between tests but reuse a production-ish Settings object.","commonSituations":"Pytest fixtures that call client.reset() without allow_reset=True; porting test helpers into prod-adjacent environments where the flag was dropped 'for safety'; notebooks that reset between runs.","solutions":["Construct the reset-capable client with the flag: chromadb.Settings(allow_reset=True) - restrict this to tests and local dev.","Or set the environment variable ALLOW_RESET=TRUE for the test/dev process only.","Never enable allow_reset in production; keep separate Settings objects for tests vs. deployment."],"exampleFix":"// before\nclient = chromadb.PersistentClient(path='./data')\nclient.reset()  # ValueError: Resetting is not allowed\n\n// after (tests/dev only)\nclient = chromadb.PersistentClient(path='./data', settings=chromadb.Settings(allow_reset=True))\nclient.reset()","handlingStrategy":"validation","validationCode":"if not settings.allow_reset:\n    # opt in explicitly - tests/dev only\n    settings = settings.model_copy(update={'allow_reset': True})\nsystem = System(settings)\nsystem.reset_state()","typeGuard":null,"tryCatchPattern":"try:\n    client.reset()\nexcept ValueError as e:\n    if 'Resetting is not allowed' in str(e):\n        raise RuntimeError('build the client with Settings(allow_reset=True) or ALLOW_RESET=TRUE (non-production only)') from e\n    raise","preventionTips":["Give test fixtures their own Settings(allow_reset=True); never reuse production Settings for resets.","Gate reset calls behind an env check (e.g. only when ALLOW_RESET=TRUE) so they no-op in prod.","Prefer creating fresh persist directories per test instead of resetting shared state."],"tags":["configuration","reset","guard","settings"],"backgroundTag":"reset-not-allowed","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}