<!-- https://pkizerotohero.com/errors/uv-unknown-issuer/ | Markdown mirror of the HTML page | PKI Zero to Hero, by Duyutech BV -->

> Fix uv UnknownIssuer with system certificates or a PEM CA bundle. Check corporate proxies, WSL, Docker and the difference from Python's trust store.

Source: https://pkizerotohero.com/errors/uv-unknown-issuer/ · Last reviewed: 2026-10-25

- 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.

[Check yours: Chain checker](https://pkizerotohero.com/tools/chain/)

## 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:

```text
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](https://pkizerotohero.com/handbook/glossary/#trust-store). [Astral documents](https://docs.astral.sh/uv/concepts/authentication/certificates/) 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:

```bash
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:

```bash
export UV_SYSTEM_CERTS=true
uv sync
```

In PowerShell:

```powershell
$env:UV_SYSTEM_CERTS = 'true'
uv sync
```

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

```toml
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](https://pkizerotohero.com/guides/add-root-ca-windows/), [macOS](https://pkizerotohero.com/guides/add-root-ca-macos/) or [Linux](https://pkizerotohero.com/guides/add-root-ca-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:

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

Or PowerShell:

```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:

```bash
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:

```bash
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](https://pkizerotohero.com/guides/build-fullchain/) 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.

Warning

Keep package downloads authenticated

`--allow-insecure-host` bypasses certificate checks. It is not a replacement for the correct CA: a modified package can become code that your build executes. Configure roots and repeat the original command with verification enabled.

## Check yours

*Interactive tool: Chain checker (runs in the browser at [/tools/chain/](https://pkizerotohero.com/tools/chain/))*

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

- [Trust stores](https://pkizerotohero.com/handbook/trust-stores/) and [certificate chains](https://pkizerotohero.com/handbook/certificate-chains/).
- [Corporate proxy certificates](https://pkizerotohero.com/guides/corporate-proxy-certificates/) for distributing the approved root.
- [Astral: TLS certificates](https://docs.astral.sh/uv/concepts/authentication/certificates/) and [official documentation source](https://github.com/astral-sh/uv/blob/main/docs/concepts/authentication/certificates.md).

**Early edition.** Written with AI assistance and checked against primary sources; an independent expert review is planned. Found a mistake? [Tell us](https://pkizerotohero.com/contact/?topic=content-error&page=/errors/uv-unknown-issuer/).

Last reviewed 25 October 2026Edition 0.9

## Learn why it happens

- [Chapter 12: Who do we trust? CAs, trust stores and self-signed certificates](https://pkizerotohero.com/handbook/trust-stores/)
- [Chapter 13: Certificate chains and path validation](https://pkizerotohero.com/handbook/certificate-chains/)

## Fix it step by step

- [How to use HTTPS on localhost with mkcert](https://pkizerotohero.com/guides/localhost-https-mkcert/)

## Everything on this topic

- [Chains and trust stores](https://pkizerotohero.com/topics/chains-and-trust/)
