• uv
  • Exact text checked with the real tool

uv: invalid peer certificate: UnknownIssuer

Also seen in: uv sync, uv pip, uv python install, uvx

In one sentence

uv cannot build a trusted certificate chain; use your organisation's approved system roots or a verified PEM bundle in the environment where uv runs.

Where you see it

During uv sync, uv pip install, a Python download or a tool installation, often behind a corporate proxy or when using an internal package index. This is the final cause reproduced with uv against a local HTTPS package index whose private root was not trusted:

cause: error sending request for url (https://localhost:46429/simple/pki-lab-nonexistent-package/)
cause: client error (Connect)
cause: invalid peer certificate: UnknownIssuer

Read the failing URL before changing anything. An index, its package download host and a Python download host can use different certificates. A successful browser visit to the index homepage does not test every connection the install will make.

What it means

uv’s TLS client cannot connect the presented certificate to a root in its trust store. Astral documents that uv uses bundled Mozilla roots by default. It does its own HTTPS work: changing Python’s certifi package or REQUESTS_CA_BUNDLE does not configure uv. The missing root may belong to an approved TLS inspection proxy, or the server may have omitted an intermediate.

Likely causes

Your organisation’s root is trusted by the OS but not by uv

Check the installed binary’s options:

uv --version
uv --help
uv sync --system-certs

The current option is --system-certs. To keep it enabled for the current shell on Linux or macOS:

export UV_SYSTEM_CERTS=true
uv sync

In PowerShell:

$env:UV_SYSTEM_CERTS = 'true'
uv sync

Alternatively, add this to the project’s existing uv.toml, preserving its other settings:

system-certs = true

For pyproject.toml, the same setting belongs under [tool.uv]. Older instructions use --native-tls or UV_NATIVE_TLS. Consult your installed version’s help if it lacks --system-certs; update through your normal installation method before copying current configuration.

System certificates help only when the correct root is already installed. Obtain the root through your organisation’s trusted distribution channel and verify its fingerprint with IT. Follow the Windows, macOS or Linux trust guide if needed. Do not trust a certificate simply because an intercepted connection presented it.

uv runs in WSL, a container or a CI worker

Each runtime has its own files and certificate configuration. A Windows browser trusting the proxy does not establish trust in WSL or in a Docker image. Install the approved CA in the environment executing uv, then enable system certificates there. CI jobs also need the setting in the job’s environment, not just your interactive terminal.

For a controlled PEM bundle on Linux:

export SSL_CERT_FILE=/etc/company/approved-ca-bundle.pem
uv sync

Or PowerShell:

$env:SSL_CERT_FILE = 'C:\Company\approved-ca-bundle.pem'
uv sync

These files contain public CA certificates, never private keys. Astral says SSL_CERT_FILE and SSL_CERT_DIR replace the default certificate source. Supply the full set of approved roots needed for your connections; a bundle containing only your private CA may break direct access to public hosts. DER files are not supported.

A stale custom bundle overrides the roots you intended to use

Inspect certificate-related variables in the failing shell:

printenv SSL_CERT_FILE SSL_CERT_DIR UV_SYSTEM_CERTS UV_NATIVE_TLS

Check that every configured path exists inside that environment. A missing file or a directory without valid PEM certificates can leave uv with no trusted roots. Remove an obsolete override through the configuration that sets it, or replace it with the maintained bundle. Restart the job or terminal after changing persistent settings.

The package server omits its intermediate certificate

Inspect the failing hostname, preserving its name for TLS:

openssl s_client -connect packages.example.com:443 \
  -servername packages.example.com -showcerts </dev/null

The server should send its leaf and required intermediates. Fix the server’s full-chain configuration when you own it; otherwise send the issuer and chain details to its administrator. A local trust override should not conceal a broken public server chain.

Check yours

Try it: Chain checkerOpen the full tool

Runs in your browser. Nothing you paste is sent anywhere.

Every certificate the server sends, leaf first. The output of openssl s_client -showcerts -connect example.com:443 works as it is: we ignore the text around the certificates.

Paste only the public PEM certificates. Then rerun the failing uv operation in the same shell, container or CI job. Confirm it reaches every required download host without an insecure-host exception.

Learn why

Guided mission · free · no account · progress saves hereChoose the root your client trusts — 6 minutesTry different trust stores and see why a self-signed root does not choose its own authority.

Does your team keep hitting this?

Everyone can use the lessons. Team seats add earned credentials, invitations and a completion report, so you see who has finished.

See team training

Early edition. Written with AI assistance and checked against primary sources; an independent expert review is planned. Found a mistake? Tell us.

Last reviewed Edition 0.9