getredash/redash · error · ValueError
Username and Password required
Error message
Username and Password required
What it means
BaseQueryRunner.get_auth raises ValueError when requires_authentication is True but the configuration lacks a truthy username or password. It is the Basic-auth precondition check run before any HTTP request by runners using get_response.
Source
Thrown at redash/query_runner/__init__.py:371
}
if cls.requires_url or cls.requires_authentication:
schema["required"] = []
if cls.requires_url:
schema["required"] += ["url"]
if cls.requires_authentication:
schema["required"] += ["username", "password"]
return schema
def get_auth(self):
username = self.configuration.get("username")
password = self.configuration.get("password")
if username and password:
return (username, password)
if self.requires_authentication:
raise ValueError("Username and Password required")
else:
return None
def get_response(self, url, auth=None, http_method="get", **kwargs):
# Get authentication values if not given
if auth is None:
auth = self.get_auth()
# Then call requests to get the response from the given endpoint
# URL optionally, with the additional requests parameters.
error = None
response = None
try:
response = requests_session.request(http_method, url, auth=auth, **kwargs)
# Raise a requests HTTP exception with the appropriate reason
# for 4xx and 5xx response status codes which is later caught
# and passed back.
response.raise_for_status()View on GitHub (pinned to ca79fe988d)
Solutions
- Open the data source settings and fill in both Username and Password
- If the endpoint needs no auth, use a runner/configuration with requires_authentication=False
- Verify configuration keys are exactly 'username' and 'password' when provisioning programmatically
Example fix
# before
configuration = {"url": "https://api.example.com", "username": "admin"}
# after
configuration = {"url": "https://api.example.com", "username": "admin", "password": os.environ["API_PASSWORD"]} Defensive patterns
Strategy: validation
Validate before calling
required = {'username', 'password'}
if requires_authentication and not required.issubset({k for k, v in configuration.items() if v}):
raise SystemExit('set username & password before creating the data source') Type guard
def has_basic_auth(config: dict) -> bool:
return bool(config.get('username')) and bool(config.get('password')) Try / catch
try:
resp = runner.get_response(url)
except ValueError as e:
if 'Username and Password required' in str(e):
fix_configuration(); retry Prevention
- Validate configuration completeness in provisioning scripts
- Load secrets from env/vault so they never ship empty
- Run test_connection right after creating the data source
When it happens
Trigger: Creating or using an HTTP/API-type query runner with requires_authentication=True while the configuration omits 'username' or 'password', or one of them is empty.
Common situations: Data source created via API/JSON without credentials, password cleared after rotation, or typo'd configuration key names.
Related errors
- Azure AD Client ID, Client Secret, and Tenant ID are require
- Neither password nor private_key_b64 is set.
- Invalid JWT token
- MongoDB connection error
- Failed describing objects.
AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28).
Data as JSON: /api/errors/a96270680839b15c.
Report an issue: GitHub.