redis/redis-py · error · ValueError
Driver name must not be None
Error message
Driver name must not be None
What it means
add_upstream_driver (redis/driver_info.py:123) explicitly rejects a None driver_name with ValueError before any further validation, because None can never be a valid package-style name and would otherwise produce a confusing downstream TypeError when _validate_no_invalid_chars iterates it. driver_version is validated separately (error 426).
Solutions
- Check that driver_name is a non-None string before calling add_upstream_driver, and skip registration when the name is unknown.
- Default to a sane hardcoded lowercase name for your driver rather than forwarding an optional lookup result.
- Log/warn when the name source is missing so silent skips are observable.
Example fix
// before
info.add_upstream_driver(config.get('driver_name'), VERSION)
// after
name = config.get('driver_name')
if name:
info.add_upstream_driver(name, VERSION) Defensive patterns
Strategy: validation
Validate before calling
def register_if_name(info, name, version):
if name is not None:
info.add_upstream_driver(name, version) Type guard
def has_name(name) -> bool:
return isinstance(name, str) and len(name) > 0 Prevention
- Skip upstream-driver registration when the name source is missing rather than forwarding None.
- Default to a hardcoded lowercase name for your driver.
- Resolve names at import time and fail loud if a required name is absent.
When it happens
Trigger: Calling driver_info.add_upstream_driver(None, '1.0.0'), or passing a variable that resolved to None (e.g. a lookup that returned None for an unknown package) as the name argument.
Common situations: Auto-registration code that pulls a driver name from optional config or importlib.metadata and forwards it unconditionally; a conditional that left the name unset.
Related errors
- Driver version must not be None
- Upstream driver name must use a Python package-style name…
- driver_info must be a DriverInfo instance or None
- must not contain spaces, newlines, non-printable…
- ACL LOG count must be an integer
AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10).
Data as JSON: /api/errors/9aac042e86bda15a.
Report an issue: GitHub.
Appendix: source
Thrown at redis/driver_info.py:123
@property
def upstream_drivers(self) -> List[str]:
"""Return a copy of the upstream driver entries.
Each entry is in the form ``"driver-name_vversion"``.
"""
return list(self._upstream)
def add_upstream_driver(
self, driver_name: str, driver_version: str
) -> "DriverInfo":
"""Add an upstream driver to this instance and return self.
The most recently added driver appears first in :pyattr:`formatted_name`.
"""
if driver_name is None:
raise ValueError("Driver name must not be None")
if driver_version is None:
raise ValueError("Driver version must not be None")
_validate_driver_name(driver_name)
_validate_driver_version(driver_version)
entry = _format_driver_entry(driver_name, driver_version)
# insert at the beginning so latest is first
self._upstream.insert(0, entry)
return self
@property
def formatted_name(self) -> Optional[str]:
"""Return the base name with upstream drivers encoded, if any.
With no upstream drivers, this is just :pyattr:`name`. Otherwise::
name(driver1_vX;driver2_vY)View on GitHub (pinned to 6a6b581b48)