When something goes wrong
What a failed start, an exit 2 and the report's warnings mean, and what to do about each.
On this page
- The app does not start in the sandbox
- The app stops on a setting nothing gives it
- A compare exits 2
- A pull is refused
- When a compare stops early
- Warnings that do not stop a compare
- A request file failed
- The report is noisy on your app
- A saved baseline never matches
- nk setup fails in a container
- nk does not start on the runner
- Run folders and zstd
- Still stuck?
- Related pages
Find your symptom below. Each section says what it means and what to do.
The app does not start in the sandbox #
Run nk try first. It starts the draft once and says why in at most 10 lines. Its last line names the edit to make.
The app stops on a setting nothing gives it #
nk try names the setting and your env file, the one x-nk: env_file records:
APP_SECRET is not set: .env (x-nk: env_file) has no line for it; add APP_SECRET=... to .env, or set it in your environment
next: set the setting above, then nk try myapp:oldPut the value in that file, as you would for docker compose up. Or give another file with --env-file, by its path from the folder you run nk in.
nk init listed the settings before the build, on its config: line and in nk/init.txt.
What the message says #
The line changes with what is wrong:
| Situation | What it prints |
|---|---|
| The line is there and empty | SMTP_HOST is not set: . |
| The file is not there yet | APP_SECRET is not set and ., with what the example file says of the setting when it says anything |
| The value is a template's placeholder | APP_SECRET still holds the template's placeholder in . |
| No env file is recorded | put APP_SECRET=... under environment: of the app in nk/ |
The app's own file leaves it empty #
The app may read a file whole under env_file: that x-nk: env_file does not record. Then the line names that file. When the example file has a comment for the setting, the line adds it:
APP_KEY is not set: app.env (a service's env_file:) leaves it empty; give it a value in app.env (the example says: "Run php artisan key:generate")The file points at localhost #
nk init names the setting and the service to use instead:
.env points DATABASE_URL at localhost, which in the sandbox is the app's own container: use `db` there instead, under environment: of the app in nk/app.yaml or in a second file listed under x-nk: env_fileYour file stays as it is, for running the app on your machine. Put the fix under environment: of the app in nk/app.yaml, or in a second file listed under x-nk: env_file.
A compare exits 2 #
Exit 2 means Nikasa could not compare. The log says why. These are the common cases.
sandbox did not start #
A service failed its health check, exited, or was not healthy 10 minutes after starting. The message names the service. It also gives:
- what its health check last said;
- its first error line and its last log line, with secrets hidden.
Each attempt's container logs are in start-failure-<n>.log in the run folder.
A start waits at most 10 minutes, in nk try and in every run of a compare. That limit is fixed. The app's health check that nk init drafts gives up sooner, after 60 failed tries 2 seconds apart. It is part of your app file, so you can change it.
When the health check's connection was refused, the message says nothing listened on that port and lists the ports the service does listen on. The fix is often x-nk: host or the app's port setting.
not trying again #
A start that held up only on a service still starting is not tried a second time. The message says why, with one of these reasons:
- nothing listened on the port the app's health check asks, at the time limit;
- the same, and the app settled on another port;
- nothing listened on that port yet when the start ended;
- a service still starting at the time limit has a health check that cannot pass here.
When the app settled elsewhere, the line before it names the port and how long it stayed unchanged.
The fix is usually x-nk: host and the health check's port. nk try corrects them when it can.
only 4 GB free on / #
The message names the drive that is short. A run needs 5 GB free for its captures and images, on the disk of the run folder and on the system disk.
The compare exits 2 with this only when the disk stopped it before any new run, so nothing was compared. If the disk stops it later, the report is still written: see below.
sandbox slot <n> is in use #
You gave --slot <n> and another run holds that network. Do one of these:
- Leave
--slotout, and a free one is taken. - Free it with
nk clear --slot <n>once no run holds it.
The old build does not start #
Nikasa has nothing to compare against. A new build that does not start is different: it is a change, and the report is headed the new build did not start.
A pack is out of date #
A pack is a saved recording of your requests that Nikasa sends again to both builds, with the answers of outside services recorded in it (Words in a report).
It is out of date when the old build makes an outside call that none of those recorded answers covers. Record the pack again.
Other causes #
- A client refuses the run's certificate for a host that has a recorded answer, so the recording cannot answer that call.
- A file
nkcannot read, or an accepted or masks file that does not parse. - There is no app file. Run
nk init. With no requests found,nk runalso stops with exit 2 and namesnk/specs, whilenk compareruns without any.
A pull is refused #
could not pull <image>: <what Docker said>; if the image needs a login, log Docker in to ghcr.ioYour Docker could not pull the image. nk demo prints this for its sample images when your Docker has no login that can read them.
-
Log in once:
docker login ghcr.ioIt asks for a GitHub username and a token that can read those images. Your invite says which to use. If you have none, write to hello@nikasa.dev.
-
Run the command again.
For the capture images, the message ends differently, and needs no login:
could not pull <image>: <what Docker said>; run nk setup, which builds itNikasa's capture image and eBPF key reader are built on your machine by nk setup, from a Dockerfile nk carries, whenever a pull is refused. nk import pcap or nk record prints this on a machine where nk setup has not run.
When a compare stops early #
When the disk runs short, a compare first lets go of the captures of the runs it has made. It lets go of the last runs first and the first old and new run last, so that two more of its biggest runs fit above the 5 GB a run needs.
It keeps what later steps read in results.json, so the report is the same with or without the captures, and a note in it names the runs. nk observe cannot read those runs again.
The disk still stops it #
If the disk still stops the compare after at least one old run and one new run, the report is written from the runs made. The compare exits as any compare does: 0, or 1 with --fail-on-change when every new run shows a change (how many runs a compare makes).
The report opens with a line like this one, with your disk and counts:
stopped early: only 4 GB free on /. This report is from the 8 old and 2 new runs made before that, so what it lists was not confirmed by every run Nikasa wanted; free space and compare again.- In
report.mdthe line is headedStopped early:. report.json, whoseschema_versionis 1.1, holds the same understopped_early, aswhyand therunsmade on each side.- No saved baseline is written or extended by a compare that stopped early.
Free space and compare again.
It stops after old runs only #
Nothing was compared. The report says stopped early, why, and how many old runs were made, and the compare exits 2.
Warnings that do not stop a compare #
These show in the report's notes or in the log. The compare goes on.
not read, so not compared #
Nikasa could not read some traffic, so it passes that traffic over. Each place is named with why and in how many old and new runs:
- UDP in a protocol it does not read, such as QUIC from a headless browser;
- the driver's connection when the app answered with something it cannot parse;
- a connection a decoder failed on, which is compared by its exchanges instead;
- a capture cut short.
None of it is compared or counted. report.json has a gaps row for each.
TLS key tools missing #
Some connections stay encrypted. Run nk setup.
eBPF key capture off #
The message gives the reason. TLS from Go and .NET 8 programs stays encrypted, and everything else is read. Usually Docker does not allow privileged containers. --no-ebpf turns the probes off.
calls not read #
The calls to a service did not decode in one old run. That run is left out of what Nikasa learns about that service, as long as at least 2 other old runs read it. What Nikasa learns means what the old runs taught it, as the top of a report section of Words in a report says.
The report names the run:
learned without old run 5 for app -> postgres:5432 (calls not read)capture lost data #
The report gives one line for each connection, side and place. What changed there after the loss is shown for information and never counted, as the report cannot tell a lost packet from a real change. A loss in an old run can hide a change but not make one.
A request file failed #
The report names it near the top, with how many old and new runs it failed in. It changes no exit status.
To look at it alone, run it once and read what the driver got:
nk run myapp:old out/runnk run exits 1 when a request file failed, and names the file. The driver's output is in driver.log in the run folder.
The report is noisy on your app #
Noise comes in two kinds, and comparing a build with itself tells them apart.
It shows when a build is compared with itself #
The same image is on both sides, so it is not your change. It comes from something that changes from run to run and that the old runs did not catch. Accept or mask each place below, then run the self-compare again.
It shows only between two different builds #
Some values change with every build, however small the change, such as a header or a file name that carries a build hash. The self-compare cannot show these, so you meet them in your first real compare.
What to do about each #
| Cause | What to do |
|---|---|
| A value only your app makes | Accept it with --any-value, or mask it. |
| A value that depends on the time or on randomness in a driver of your own | Keep it out of the command. |
A saved baseline never matches #
An old image rebuilt in every job usually gets a new id each time, and the baseline key includes that id. Pull the old build by tag or digest where you can.
A new secret key also makes a new baseline key. How it decides, on the Saved baselines page, lists everything that goes into the key, and the report says which part changed.
nk setup fails in a container #
gcc: error: /src/nk-keys.c: No such file or directoryThe folder nk setup stages its tool sources in is not shared with the host at the same path. See runners where Nikasa is itself in a container.
nk does not start on the runner #
version `GLIBC_2.34' not foundThe runner's glibc is too old for the default download. Use the static nk-x86_64-unknown-linux-musl download. See Which download.
Run folders and zstd #
Each run keeps a folder of its own, old-1, new-1 and so on, in the compare's output folder.
nk observe, nk diff and --replay read run folders whether their big files are packed with zstd or not. To unpack one for another tool:
zstd -d --rm <run-folder>/*.zstStill stuck? #
Write to hello@nikasa.dev with the report's first lines and the error.
Related pages #
- The app file: what
nk trychecks, and how to change the draft. - Commands: the exit statuses.
- Your first compare: what a compare does, and how to read the report.
Written for nk 0.3.14. Something wrong or unclear? Write to hello@nikasa.dev.