zylon-ai/private-gpt · error · ValueError

Unsupported store type: {store}

Error message

Unsupported store type: {store}

What it means

The `match store` in `_get_migration_backend` handles only 'postgres' and 'sqlite'; any other `settings.database.provider` value falls to `case _` and raises `ValueError(f"Unsupported store type: {store}")`. Note this is backend selection, independent of whether the provider's client deps are installed.

Source

Thrown at private_gpt/components/persistence/persistence_component.py:73

        client: Any,
    ) -> MigrationBackend:
        match store:
            case "postgres" | "sqlite":
                from private_gpt.components.migrations.backend.sqlalchemy_backend import (
                    SQLAlchemyMigrationBackend,
                )

                engine = client.sync_session.kw.get("bind")
                if engine is None:
                    raise ValueError(
                        f"Cannot resolve SQLAlchemy engine for migration store '{store}'"
                    )
                return SQLAlchemyMigrationBackend(
                    engine=engine,
                    schema_name=self._settings.database.schema_name,
                )
            case _:
                raise ValueError(f"Unsupported store type: {store}")

    def apply_migrations(self) -> None:
        with self._lock:
            if self._migrations_applied:
                logger.info("Migrations already applied in this process; skipping")
                return

            store = self._settings.database.provider
            schema = self._settings.database.schema_name
            logger.info(
                "Applying migrations with provider=%s schema=%s total=%s",
                store,
                schema,
                len(MIGRATIONS),
            )
            client = self.get_client(store)
            if client is None:
                raise ValueError(

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Set `database.provider` to exactly `postgres` or `sqlite`
  2. Check for typos/casing/whitespace in the settings value
  3. If you added a custom provider, extend `_get_migration_backend` and `get_client` with a matching case and backend

Example fix

# before
database:
  provider: postgresql  # unsupported

# after
database:
  provider: postgres
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_MIGRATION_STORES = {"postgres", "sqlite"}
if settings.database.provider not in SUPPORTED_MIGRATION_STORES:
    raise ValueError(
        f"database.provider must be one of {sorted(SUPPORTED_MIGRATION_STORES)}, "
        f"got {settings.database.provider!r}"
    )

Type guard

def is_supported_migration_store(store: str) -> bool:
    return store in {"postgres", "sqlite"}

Try / catch

try:
    persistence.apply_migrations()
except ValueError as e:
    if "Unsupported store type" in str(e):
        raise ConfigurationError(str(e)) from e
    raise

Prevention

When it happens

Trigger: Setting `database.provider` to a value outside {postgres, sqlite} (typo, or a provider supported for storage but not migrations) and then calling `apply_migrations()` (run at startup) or `revert_migrations()`; provider strings with different casing/whitespace.

Common situations: Hand-edited settings with provider typos; new provider values introduced by config tooling but not by the migration layer; case mismatches.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/8d4c51c2b8e995a3. Report an issue: GitHub.