{"record":{"id":"0d5be7688666fc2f","repo":"reflex-dev/reflex","slug":"self-prefixes-0-redis-url-is-required-when-usin","errorCode":null,"errorMessage":"{self._prefixes[0]}REDIS_URL is required when using the redis state manager.","messagePattern":"(.+?)REDIS_URL is required when using the redis state manager\\.","errorType":"exception","errorClass":"ConfigError","httpStatus":null,"severity":"critical","filePath":"packages/reflex-base/src/reflex_base/config.py","lineNumber":415,"sourceCode":"                removal_version=\"1.0\",\n            )\n\n        #   Update default URLs if ports were set\n        kwargs.update(env_kwargs)\n        self._non_default_attributes = set(kwargs.keys())\n        self._replace_defaults(**kwargs)\n\n        # Publish for State-class creation so it never re-enters get_config()\n        # (which AttributeErrors if a State is defined while rxconfig.py is mid-import).\n        global _state_auto_setters\n        _state_auto_setters = self.state_auto_setters\n\n        if (\n            self.state_manager_mode == constants.StateManagerMode.REDIS\n            and not self.redis_url\n        ):\n            msg = f\"{self._prefixes[0]}REDIS_URL is required when using the redis state manager.\"\n            raise ConfigError(msg)\n\n        allowed_color_modes = constants.LiteralColorMode.__args__\n        if self.default_color_mode not in allowed_color_modes:\n            msg = (\n                f\"default_color_mode must be one of \"\n                f\"{allowed_color_modes}, but got {self.default_color_mode!r}.\"\n            )\n            raise ConfigError(msg)\n\n    def _normalize_plugins(self):\n        \"\"\"Normalize ``plugins`` entries to Plugin instances.\n\n        Auto-instantiates Plugin subclasses passed without parentheses (e.g.\n        ``plugins=[SitemapPlugin]``) so they behave the same as\n        ``plugins=[SitemapPlugin()]``. Any entry that is neither a Plugin\n        subclass nor a Plugin instance raises ``ConfigError`` with a message\n        that names the offending value, instead of failing later in the\n        compiler with a confusing ``TypeError`` about a missing ``self``.","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/config.py#L397-L433","documentation":"The app config sets `state_manager_mode=StateManagerMode.REDIS` but no `redis_url` was provided (via Config or the environment-specific `REDIS_URL` env var). The Redis state manager needs a live Redis connection string to function.","triggerScenarios":"`rx.Config(state_manager_mode=constants.StateManagerMode.REDIS)` without `redis_url=`, and no REDIS_URL/PROD_REDIS_URL env var set for the current environment.","commonSituations":"Scaling to multiple backend processes in production (Redis is required there), deploying without passing secrets/env vars, or local testing of redis mode without a local Redis instance.","solutions":["Set `redis_url` in `rx.Config(...)` (e.g. `redis_url=os.environ[\"REDIS_URL\"]`)","Or export the env-prefixed REDIS_URL variable (e.g. PROD_REDIS_URL in prod)","Or switch back to the default state manager for single-process apps"],"exampleFix":"# before\napp = rx.App(state_manager_mode=constants.StateManagerMode.REDIS)\n\n# after\napp = rx.App(state_manager_mode=constants.StateManagerMode.REDIS, redis_url=\"redis://localhost:6379\")","handlingStrategy":"validation","validationCode":"import os\n\nREDIS_URL = os.environ.get(\"REDIS_URL\") or os.environ.get(\"PROD_REDIS_URL\")\nassert REDIS_URL, \"REDIS_URL must be set before creating the app\"\n\napp = rx.App(\n    state_manager_mode=\"redis\",\n    redis_url=REDIS_URL,\n)","typeGuard":null,"tryCatchPattern":"from reflex.config import ConfigError\n\ntry:\n    app = rx.App(state_manager_mode=\"redis\", redis_url=url)\nexcept ConfigError:\n    app = rx.App()  # fall back to memory state manager for local dev","preventionTips":["Fail fast at boot: assert the env var exists before constructing the app","Add REDIS_URL to .env.example and deployment secrets","Only enable redis mode when actually running multiple processes"],"tags":["reflex","config","redis","state-manager","missing-env-var"],"backgroundTag":"missing-env-var","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}