{"record":{"id":"250c34274963e57e","repo":"zylon-ai/private-gpt","slug":"redis-semaphore-dependencies-are-not-installed-in","errorCode":null,"errorMessage":"Redis semaphore dependencies are not installed. Install with `uv sync --inexact --extra redis`.","messagePattern":"Redis semaphore dependencies are not installed\\. Install with `uv sync --inexact --extra redis`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":400,"severity":"error","filePath":"private_gpt/components/concurrency/registry.py","lineNumber":28,"sourceCode":"\nlogger = logging.getLogger(__name__)\n\nSemaphoreManagerProvider = Callable[\n    [Settings | None, int | None, str | None], SemaphoreManager\n]\n\n\ndef _redis_semaphore_provider(\n    settings: Settings | None,\n    max_concurrency: int | None,\n    queue_key: str | None,\n) -> SemaphoreManager:\n    try:\n        from private_gpt.components.concurrency.redis_semaphore_manager import (\n            RedisSemaphoreManager,\n        )\n    except ImportError as e:\n        raise ImportError(\n            format_missing_dependency_message(\"Redis semaphore\", extras=\"redis\")\n        ) from e\n\n    logger.info(\"Using RedisSemaphoreManager for concurrency control\")\n    return RedisSemaphoreManager(\n        settings=settings,\n        max_concurrency=max_concurrency,\n        queue_key=queue_key,\n    )\n\n\ndef _memory_semaphore_provider(\n    settings: Settings | None,\n    max_concurrency: int | None,\n    queue_key: str | None,\n) -> SemaphoreManager:\n    del settings\n    from private_gpt.components.concurrency.memory_semaphore_manager import (","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/concurrency/registry.py#L10-L46","documentation":"The concurrency registry lazily imports RedisSemaphoreManager; if the optional redis extra is not installed, the ImportError is re-raised as a friendlier message telling you exactly how to install it (uv sync --inexact --extra redis). It fires only when settings actually select the redis concurrency backend.","triggerScenarios":"Configuring concurrency/semaphore settings to use the Redis backend in an environment where the redis optional dependencies are absent, triggering _redis_semaphore_provider's import.","commonSituations":"Enabling Redis-based concurrency in a deployment installed without the redis extra; CI or slim Docker images trimming extras; local dev on a machine that never ran uv sync with the extra.","solutions":["Install the extra: uv sync --inexact --extra redis (as the message says)","Or switch settings to the in-memory semaphore provider if Redis is not actually needed","Add the redis extra to the deployment's install command / Dockerfile so it's always present","Add a startup check that fails fast when the selected backend's deps are missing"],"exampleFix":"# before\n# settings select redis semaphore, deps missing\n\n# after\nuv sync --inexact --extra redis\n# or in settings: concurrency.backend = \"memory\"","handlingStrategy":"validation","validationCode":"if settings.concurrency.backend == \"redis\":\n    try:\n        import redis  # noqa: F401  (proxy for the redis extra)\n    except ImportError:\n        raise ConfigError(\"run `uv sync --inexact --extra redis` before enabling redis concurrency\")","typeGuard":null,"tryCatchPattern":"try:\n    manager = semaphore_registry.get_manager(settings)\nexcept ImportError as e:\n    if \"extra redis\" in str(e):\n        raise ConfigError(\"Redis extra missing — install with `uv sync --inexact --extra redis` or use the memory backend\") from e\n    raise","preventionTips":["Install extras in the same step that enables their settings (Dockerfile/IaC)","Add a startup dependency check for every optional backend in settings","Keep slim images consistent with the selected concurrency backend"],"tags":["concurrency","redis","optional-dependency","installation"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}