Skip to main content

Starception

Beautiful exception page for Starlette and FastAPI apps.

PyPI GitHub Workflow Status GitHub Libraries.io dependency status for latest release PyPI - Downloads GitHub Release Date

Screenshot

image

Dark theme

Features

  • secrets masking with reveal button
  • solution hints
  • exception notes (Python 3.11+)
  • exception chains
  • code snippets with syntax highlighting
  • request info: query params, headers, cookies
  • session contents
  • request and app state
  • platform information
  • environment variables
  • open paths in editor (VSCode; extensible via custom link templates)
  • dark theme

Installation

pip install starception
# or with uv
uv add starception

With syntax highlighting

Install with the highlight extra for syntax-highlighted code snippets:

pip install starception[highlight]
# or with uv
uv add starception[highlight]

Usage

Starception works only in debug mode — make sure debug=True is set on your app.

Call install_error_handler before creating your application instance:

Starlette

from starception import install_error_handler
from starlette.applications import Starlette

install_error_handler()
app = Starlette(debug=True)

FastAPI

from starception import install_error_handler
from fastapi import FastAPI

install_error_handler()
app = FastAPI(debug=True)

See the example application in the examples/ directory for a full demo of all features.

Integration with other frameworks

Starception exports starception.exception_handler(request, exc), which you can use directly. Keep in mind that Starlette will not call custom exception handlers in debug mode — it always uses its built-in one.

The snippet below will not work as expected:

from starlette.applications import Starlette
from starception import exception_handler

app = Starlette(
    debug=True,
    exception_handlers={Exception: exception_handler}
)

Use install_error_handler() instead (shown above).

Secrets masking

Starception automatically masks values whose key contains key, secret, token, or password, and redacts passwords from URL-valued keys (e.g. database_url). Masked values are replaced with ******** and can be revealed by clicking the reveal button next to them.

Solution hints

If an exception class has a solution attribute, its content will be shown as a hint on the error page.

class DatabaseError(Exception):
    solution = (
        'The connection to the database cannot be established. '
        'Either the database server is down or connection credentials are invalid.'
    )

image

Exception notes

Python 3.11+ supports attaching notes to exceptions via add_note(). Starception displays them on the error page.

err = ValueError("something went wrong")
err.add_note("Check that the config file exists and is readable.")
raise err

Exception chains

When exceptions are chained — either explicitly (raise X from Y) or implicitly (raising inside an except block) — Starception renders each exception in the chain as a separate block, so you can trace the full error path.

Opening files in editor

Pass your editor to install_error_handler to make file paths in stack frames clickable:

from starception import install_error_handler

install_error_handler(editor='vscode')

Supported editors:

Editor Value
VSCode vscode

image

Custom link templates

Register any editor with add_link_template:

from starception import install_error_handler, add_link_template

add_link_template('zed', 'zed://file/{path}:{lineno}')
install_error_handler(editor='zed')

Dark theme

The error page supports light, dark, and auto (follows system preference) themes. The toggle is in the top-right corner of the page and the chosen theme is persisted across page loads.

Credits

Metadata

Release files for starception 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for starception 1.3.0
File Size Uploaded
starception-1.3.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for starception 1.3.0
File Interpreter ABI Platform
starception-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.5 kB

Release files / starception-1.3.0.tar.gz

Download URL starception-1.3.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
091a1fb3454395164513b249c0f59b269d2a8d421f4cd0d9bef85521830dffee
BLAKE2b-256 checksum
How to use checksums
8069c56f91ee8d522cbbe0c62949cb636f555269e35c5f9a34f04bcaa959f2d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / starception-1.3.0-py3-none-any.whl

Download URL starception-1.3.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75389827a0d42a5a86ca6d4590cade830ada4325dbf7aadc248c7ca56b9c4572
BLAKE2b-256 checksum
How to use checksums
3c1320017ba7a5d667312909f5e8be9928929deb7626e1fc9a9c492d934871a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.1

2 release files

1.0.1

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page