crewAIInc/crewAI · error · ValueError

REDIS_URL environment variable is not set

Error message

REDIS_URL environment variable is not set

What it means

Error "REDIS_URL environment variable is not set" thrown in crewAIInc/crewAI.

Source

Thrown at lib/crewai-core/src/crewai_core/lock_store.py:75

def _redis_available() -> bool:
    """Return True if redis is installed and REDIS_URL is set."""
    if not _REDIS_URL:
        return False
    try:
        import redis  # noqa: F401

        return True
    except ImportError:
        return False


@lru_cache(maxsize=1)
def _redis_connection() -> redis.Redis[bytes]:
    """Return a cached Redis connection, creating one on first call."""
    from redis import Redis

    if _REDIS_URL is None:
        raise ValueError("REDIS_URL environment variable is not set")
    return Redis.from_url(_REDIS_URL)


@contextmanager
def lock(name: str, *, timeout: float = _DEFAULT_TIMEOUT) -> Iterator[None]:
    """Acquire a named lock, yielding while it is held.

    Args:
        name: A human-readable lock name (e.g. ``"chromadb_init"``). The
              built-in default namespaces it to avoid collisions; a custom
              backend receives it verbatim.
        timeout: Maximum seconds to wait for the lock before raising.
    """
    # Snapshot the global once: a concurrent set_lock_backend() must not turn
    # the check-then-call into calling ``None``.
    backend = _backend
    if backend is not None:
        with backend(name, timeout=timeout):

View on GitHub (pinned to 754d7323be)

Solutions

  1. Set the REDIS_URL environment variable to your Redis connection string.
  2. Install and run Redis locally, then set REDIS_URL=redis://localhost:6379.

When it happens

Trigger: Thrown at lib/crewai-core/src/crewai_core/lock_store.py:75 when the library encounters an invalid state.

Common situations: Occurs when initializing the Redis-backed lock store without the REDIS_URL environment variable set. Export REDIS_URL pointing to a reachable Redis instance.


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/635f1855675dc684. Report an issue: GitHub.