Skip to content

Troubleshooting

Outcome: the failures this guide's lab actually met, plus the structural ones the moving parts predict — each with the check that names it.

"Invalid v1 token" — but my token is new

You sent a version 2 token without its nbt_ prefix, so the server classified it as a legacy v1 token and matched it against the wrong store. The lab did exactly this: every call in its first API run failed with {"detail":"Invalid v1 token"} (transcript t07-api-first-attempt-prefix.txt). The check: the header must read Authorization: Bearer nbt_<key>.<plaintext>. With the prefix, the identical calls returned 201 (t08-api-proof.txt). The mirror image — Invalid v2 token — means the prefix was right and the key or plaintext was not: wrong token, revoked token, or a token from a different install.

My token's secret is lost

For v2 tokens that is permanent, and by design: only a peppered hash is stored. The lab created one token whose generated plaintext it failed to capture; the token was deleted and a fresh one created with the plaintext recorded at creation. There is no recovery path to look for. Capture the plaintext when the token is made, and store it where you store credentials.

A create is refused with a 400 and a field name

That is the database's rules arriving as JSON, not a malfunction: {"slug":["site with this slug already exists."]} means exactly what it says. Read the field named in the answer; it is the constraint you hit. The same shape appears for duplicate addresses, bad references (an ID that does not exist) and malformed values. Fix the input, not the server.

Pages answer but nothing happens in the background

The web application and the worker are different processes (chapter 2). Housekeeping, webhooks and reports sit in the Redis-backed queue until a worker takes them. The check is the queue: the lab ran manage.py rqworker default --burst and watched a queued System Housekeeping job complete (t10-rqworker-burst.txt). A queue that only grows means the worker service is not running — in production it is its own service, separate from the web server, and forgetting to start it is the classic first-week mistake.

NetBox will not start, or starts empty

Work the moving parts in order. PostgreSQL reachable on the host and port in configuration.py, with the named database present? Redis answering on its port? Migrations applied — manage.py showmigrations should show no unapplied entries (the lab's clean install ended at 337 applied, none pending). A NetBox that starts but shows no records is almost always pointing at a different, emptier database than the one you filled.

The install failed building psycopg

The pinned driver builds a C extension and needs PostgreSQL's server headers (pg_config.h). Without them the build dies with that file named as missing — the lab's first install attempt, kept in t02-psycopg-substitution.txt. Two honest fixes: install the headers (postgresql-server-dev for your version), or use the driver's official prebuilt distribution, psycopg[binary,pool], as the lab did. What not to do is pin an old driver to make the error go away.

Everything is slow on a small machine

The fresh-install migration run and the first page loads are the worst of it — 337 migrations took the lab's small shared machine minutes. Steady-state slowness on modest hardware is usually the worker and the web process competing with everything else on the box; NetBox assumes it is the point of the machine it lives on. Size the host for the map's importance, not its record count.