chroma-core/chroma · error · ValueError

Resetting the database is not allowed. Set `allow_reset` to

Error message

Resetting the database is not allowed. Set `allow_reset` to true in the config in tests or other non-production environments where reset should be permitted.

What it means

SqliteDB.reset_state (chromadb/db/impl/sqlite.py) drops every table in the SQLite catalog file. It independently re-checks the same guard as System-level reset - settings.require('allow_reset') - and raises ValueError when the flag is unset. So even direct, component-level resets honor the allow_reset=False default; this is the error you see from client.reset() on an embedded/persistent deployment.

Source

Thrown at chromadb/db/impl/sqlite.py:150

    @override
    def migration_scope() -> str:
        return "sqlite"

    @override
    def migration_dirs(self) -> Sequence[Traversable]:
        return self._migration_imports

    @override
    def tx(self) -> TxWrapper:
        if not hasattr(self._tx_stack, "stack"):
            self._tx_stack.stack = []
        return TxWrapper(self._conn_pool, stack=self._tx_stack)

    @trace_method("SqliteDB.reset_state", OpenTelemetryGranularity.ALL)
    @override
    def reset_state(self) -> None:
        if not self._settings.require("allow_reset"):
            raise ValueError(
                "Resetting the database is not allowed. Set `allow_reset` to true in the config in tests or other non-production environments where reset should be permitted."
            )
        with self.tx() as cur:
            # Drop all tables
            cur.execute(
                """
                    SELECT name FROM sqlite_master
                    WHERE type='table'
                    """
            )
            for row in cur.fetchall():
                cur.execute(f"DROP TABLE IF EXISTS {row[0]}")
        self._conn_pool.close()
        self.start()
        super().reset_state()

    @trace_method("SqliteDB.setup_migrations", OpenTelemetryGranularity.ALL)
    @override

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Enable the guard for the test/dev process: Settings(allow_reset=True) or env ALLOW_RESET=TRUE.
  2. For local development, deleting the persist directory / .sqlite files is an alternative that needs no flag.
  3. Keep allow_reset out of production configs entirely - the guard exists to protect persisted data.

Example fix

// before
settings = chromadb.Settings(persist_directory='./data')
client = chromadb.PersistentClient(settings=settings)
client.reset()  # ValueError: Resetting the database is not allowed

// after (tests only)
settings = chromadb.Settings(persist_directory='./data', allow_reset=True)
client = chromadb.PersistentClient(settings=settings)
client.reset()
Defensive patterns

Strategy: validation

Validate before calling

if not settings.allow_reset:
    settings = settings.model_copy(update={'allow_reset': True})  # tests/dev only
client = chromadb.PersistentClient(path='./data', settings=settings)
client.reset()  # reaches SqliteDB.reset_state with the guard satisfied

Try / catch

try:
    client.reset()
except ValueError as e:
    if 'Resetting the database is not allowed' in str(e):
        # alternative for local dev: just delete the files
        raise RuntimeError('set allow_reset=True, or delete the ./data sqlite files instead') from e
    raise

Prevention

When it happens

Trigger: client.reset() on a PersistentClient without allow_reset=True (the reset cascades down to SqliteDB.reset_state); custom harnesses calling the SqliteDB component's reset_state directly.

Common situations: Integration-test teardown that resets the embedded database between tests; dev scripts that want a clean slate but reuse the app's Settings.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/8ea374162fd67537. Report an issue: GitHub.