View a markdown version of this page

Troubleshooting the Redshift extension for DuckDB - Amazon Redshift

Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026. We will start enforcing it in phases. For more information on the details of Python end of life and migration options, see the blog post that was published on June 30, 2025.

Troubleshooting the Redshift extension for DuckDB

This topic helps you diagnose and resolve common errors when you install, load, attach, connect to, and query with the extension, and shows how to turn on logging for deeper diagnosis. The errors usually come from a missing install or load, a misconfigured attach, a network or credential problem, or a query limitation.

Each error from Redshift or the driver carries a SQLSTATE on a line of its own. A message that the statement couldn't run or couldn't return the result means the statement might have taken effect, so check its effects before you run it again.

Install and load

The following table lists common install and load errors, their causes, and fixes.

Message Cause Fix

INSTALL fails with an HTTP error.

The repository has no build for this DuckDB version or platform.

Check that DuckDB is the supported version (Compatibility and updates), on a supported platform (Platform requirements).

The redshift.duckdb_extension file was not found.

The extension is not installed for this DuckDB version, or it is not loaded in this session.

Run INSTALL redshift FROM aws.amazon.com; and LOAD redshift FROM aws.amazon.com;, then attach again.

The driver needs libkeyutils.so.1, which this host does not have.

The Linux host lacks the keyutils library.

Install libkeyutils1 on Debian or Ubuntu, or keyutils-libs on Amazon Linux, RHEL, or Fedora, then restart DuckDB.

This build carries no driver for this platform.

The build has no embedded driver for this platform.

Use a supported platform and a published build.

Attach

The following table lists common attach errors, their causes, and fixes.

Message Cause Fix

A Redshift handle cannot be named memory.

An empty path without AS.

Add AS handle.

A required CREDENTIAL_PROVIDER parameter is missing.

The attach names no credential source.

Name one credential source (CREDENTIAL_PROVIDER aws_default_chain, CREDENTIAL_PROVIDER profile with PROFILE, or SECRET).

Missing target.

The attach gives DATABASE with no workgroup, cluster, or endpoint.

With an earlier release of the extension, the attach names no workgroup, cluster, or endpoint, and that release doesn't attach Amazon Redshift Serverless with express configuration.

To attach the express configuration, leave out DATABASE; its database is dev. To attach a workgroup or cluster instead, name a workgroup with ACCOUNT_ID or a cluster, or give the endpoint as a redshift:// path.

With an earlier release, take the latest release, as described in Compatibility and updates.

Invalid ATTACH option.

An option name the extension doesn't know.

Remove it.

Give the endpoint and its port as the path instead.

A HOST or PORT that doesn't repeat the path.

Leave HOST and PORT out, and give the endpoint and port in the redshift:// path.

The path is an ARN that names its target by ID, and finding it needs an AWS lookup that this extension doesn't make.

A workgroup ARN by ID under TYPE redshift.

Give the workgroup by its endpoint or by WORKGROUP with ACCOUNT_ID, or the cluster by its endpoint or CLUSTER.

A Redshift handle cannot be read-only.

READ_ONLY was given.

Remove it. Use SELECT-only grants.

AWS secret 'name' holds no AWS credentials (no key ID or secret key)

The secret has no keys, because the aws extension couldn't resolve credentials when the secret was created.

Create the secret again with credentials the aws extension can resolve, then attach again.

Attach values

An attach checks the WORKGROUP, ACCOUNT_ID, CLUSTER, DATABASE, and REGION values when it opens the connection.

Message Cause Fix

The value is not an aws-partition AWS Region name.

A misspelt or unsupported AWS Region.

Use a lower-case aws partition AWS Region such as us-east-1.

The WORKGROUP value is not valid.

A bad workgroup name.

Fix WORKGROUP.

The ACCOUNT_ID value is not 12 digits.

An account ID that is not 12 digits.

Fix ACCOUNT_ID.

The CLUSTER value is not valid.

A bad cluster identifier.

Fix CLUSTER.

Connect

The following table lists common connection errors, their causes, and fixes.

Message Cause Fix

The AWS credentials were refused or have expired.

The secret's temporary credentials expired or are invalid. The extension does not refresh them.

Recreate the secret to get new credentials, then retry.

No usable AWS credentials were found through the AWS credential chain.

The chain reached no usable credentials for this process.

Make credentials reachable through environment variables, the profile that PROFILE names, or the host's role. For IAM Identity Center, run aws sso login and use a secret. Name a profile that assumes a role with PROFILE.

The AWS identity is not allowed to connect to the target.

Missing IAM permissions.

For the required actions, see Authentication and IAM permissions.

The Redshift workgroup (or cluster) was not found.

A wrong workgroup, account, or AWS Region. For a cluster, a wrong cluster name or a paused cluster.

Check WORKGROUP, ACCOUNT_ID, and REGION, or the endpoint and AWS Region. For a cluster, check whether it is paused and resume it.

The server's TLS certificate could not be verified.

No usable CA bundle, or something intercepts TLS.

Check SSL_CERT_FILE or the system store, and the network path. Verification cannot be turned off.

The workgroup did not answer within the connect attempts.

A Redshift Serverless workgroup is resuming, or it is not reachable from this network. A workgroup whose traffic the network drops, such as a private one, fails only after the resume wait.

Retry, and check that the endpoint is reachable from this host.

The Redshift workgroup's host name could not be resolved.

A wrong endpoint, or this host can't resolve public names.

Check the endpoint's spelling and the host's DNS resolution.

The Redshift cluster did not answer.

The cluster isn't reachable from this network.

Check the cluster's public access, security group, and route.

Each new connection waits about 12 seconds before it connects.

The instance metadata service doesn't answer, so the driver's AWS SDK waits on its region lookup.

Set AWS_REGION for the DuckDB process, or AWS_EC2_METADATA_DISABLED=true on a host that isn't an Amazon EC2 instance.

The database was not found on the Redshift workgroup, SQLSTATE 3D000.

A wrong DATABASE or path database, or an auto-mounted catalog named directly.

Check DATABASE. To read an auto-mounted catalog, connect to dev and use a three-part name.

Cannot connect to shared database, SQLSTATE 55000.

DATABASE names a catalog that takes no connections, such as awsdatacatalog.

Connect to dev and use a three-part name.

No CA certificate bundle was found.

The host has no readable CA bundle.

Install the operating system's CA certificates, or set SSL_CERT_FILE to a file of PEM CA certificates.

No usable directory to install the Redshift ODBC driver in.

Each directory the extension tried broke a rule, which the message names.

Set REDSHIFT_DRIVER_DIR to a directory only you can write.

Query

The following table lists common query errors, their causes, and fixes.

Message Cause Fix

The handle cannot be browsed as a catalog.

A reference such as SELECT ... FROM handle.schema.table.

Use redshift_query('handle', '...').

redshift_query cannot run while a DuckDB transaction is open.

It was called inside a BEGIN.

Run it in autocommit mode.

The Redshift transaction is aborted.

An earlier error in a Redshift transaction.

Run ROLLBACK through redshift_query.

The connection was lost, and the statement was not replayed.

The network or the server dropped the session.

Check whether a write took effect, then run again.

A column has a type this extension does not support.

An unsupported type.

Cast the column in the Redshift SQL. See Data type mapping.

A statement holding ? returns or fails oddly.

The driver rewrites each ? into a parameter marker.

Write no ? in the SQL text; use $1, $2, and so on for parameters, and chr(63) for a literal question mark.

The statement's result shape changed on the server after it was checked.

Redshift gave a column another type when the statement ran than when it was checked, as it can for an expression over a system view.

Cast the column in the Redshift SQL, such as (queue_time / 1e6)::DOUBLE PRECISION. Check a write's effects, since the statement might have run.

redshift_query cannot use attach handle more than once in the same DuckDB statement.

A handle was used in two calls in one statement.

Stage one result in a DuckDB temporary table first, or attach a second handle.

Logging

The extension writes debug lines and warnings through the DuckDB logger. Because an attach now opens a connection, turn on debug logging before you attach, so that the connect lines are captured. Keep it in memory so that the DuckDB CLI can query it, and read the log:

CALL enable_logging(level = 'debug', storage = 'memory'); LOAD redshift FROM aws.amazon.com; ATTACH '' AS rs (TYPE redshift, WORKGROUP 'my-workgroup', ACCOUNT_ID '111122223333', REGION 'us-east-1', CREDENTIAL_PROVIDER aws_default_chain); SELECT * FROM redshift_query('rs', 'SELECT 1'); SELECT log_level, message FROM duckdb_logs WHERE message ILIKE '%redshift%';

Run these after DISCONNECT; while connected, they go to Redshift. DuckDB's own query log records each statement as written, including any key in the SQL, so check the log before you share it.

Redshift records each connection's application name as duckdb_redshift/extension-version duckdb/duckdb-version platform, which SYS_CONNECTION_LOG records. Match it with LIKE 'duckdb_redshift/%'. Reading SYS_CONNECTION_LOG needs permission to read the view, which a newly mapped IAM database user doesn't have. On Amazon Redshift Serverless with express configuration, reading SYS_CONNECTION_LOG needs a role association for sys:operator, sys:dba, or sys:superuser. For more information, see Data access and permissions.