getredash/redash · error · ValueError

Extra parameters may not contain {}

Error message

Extra parameters may not contain {}

What it means

The PostgreSQL runner splits configuration between the DSN string and separate fields (user, password, host, port, dbname). _parse_dsn() runs psycopg2's parse_dsn on the DSN and refuses to proceed if any of those five standard keys also appear inside the DSN, raising ValueError to avoid ambiguous duplicate configuration.

Source

Thrown at redash/query_runner/pg.py:146

            os.remove(v)


def _get_ssl_config(configuration):
    ssl_config = {"sslmode": configuration.get("sslmode", "prefer")}

    _create_cert_file(configuration, "sslrootcert", ssl_config)
    _create_cert_file(configuration, "sslcert", ssl_config)
    _create_cert_file(configuration, "sslkey", ssl_config)

    return ssl_config


def _parse_dsn(configuration):
    standard_params = {"user", "password", "host", "port", "dbname"}
    params = psycopg2.extensions.parse_dsn(configuration.get("dsn", ""))
    overlap = standard_params.intersection(params.keys())
    if overlap:
        raise ValueError("Extra parameters may not contain {}".format(overlap))
    return params


class PostgreSQL(BaseSQLQueryRunner):
    noop_query = "SELECT 1"

    @classmethod
    def configuration_schema(cls):
        return {
            "type": "object",
            "properties": {
                "user": {"type": "string"},
                "password": {"type": "string"},
                "host": {"type": "string", "default": "127.0.0.1"},
                "port": {"type": "number", "default": 5432},
                "dbname": {"type": "string", "title": "Database Name"},
                "dsn": {"type": "string", "default": "application_name=redash", "title": "Parameters"},
                "sslmode": {

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Put only non-standard options in the DSN, e.g. "sslmode=require connect_timeout=10", and set user/password/host/port/dbname in their dedicated Redash fields
  2. If a URI is needed for options, keep the standard parts in the fields, e.g. dsn="?sslmode=require" style extras only
  3. Re-test the connection after moving values out of the DSN

Example fix

# before
dsn = "postgresql://u:p@host:5432/mydb?sslmode=require"
# after
dsn = "sslmode=require"  # plus host=host, port=5432, dbname=mydb, user=u, password=p in their own fields
Defensive patterns

Strategy: validation

Validate before calling

std = {'user','password','host','port','dbname'}
from psycopg2.extensions import parse_dsn
overlap = std & set(parse_dsn(dsn))
assert not overlap, f'move {overlap} out of the DSN into their own fields'

Prevention

When it happens

Trigger: A DSN like "postgresql://user:pass@host:5432/mydb" or "host=db user=u password=p dbname=mydb" — any DSN containing user/password/host/port/dbname keys overlapping the runner's standard params.

Common situations: Pasting a full connection URI from another tool (psql, SQLAlchemy) into Redash's DSN field, since Redash expects the DSN to hold only extra options (sslmode, connect_timeout, etc.).

Related errors


AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28). Data as JSON: /api/errors/63b678f74e623dad. Report an issue: GitHub.