# nanovm: Error Codes and Fixes https://nma.sh/llms.txt is the whole guide. ## Error Codes and Fixes Every error is one JSON object on stdout: {"error":{"code":"","message":"...","hint":"..."}} "hint" is on the errors the CLI makes itself; the server's message says what to change. On nma.sh, run a Fix's nanovm COMMAND as ssh nma.sh COMMAND --json. Exit codes: 0 done. 4 the server refused the request (any 4xx: compile_error, not_found, conflict, ..., and the door's account errors): change the request. 1 a 5xx, or a local problem (below). 2 usage. 3 a deploy whose first request answered 5xx: stdout is the deploy answer, with "first":{"status":500,...}; the version it replaced serves again ("status":"rolled_back", "serving"). 75 no answer: run it again. ### CLI Error Codes - usage, unknown_command (exit 2): invalid arguments, or a command the SSH door does not know. Fix: nanovm help --json lists every command - invalid (exit 2): a db key or prefix is over 512 bytes; (exit 4): not an email address, or the server's 400 unchanged. Fix: shorten the key, or send a real address - unreachable (exit 75): no server answered. Fix: check network and server status, then run it again - outcome_unknown (exit 75, or exit 1 when it cannot print): the change may have applied. Fix: nanovm retry - pending_request, pending_key_mismatch (exit 1): an earlier change's outcome is unknown, or it belongs to another key. Fix: nanovm retry, or login with the key that started it - corrupt_pending, corrupt_ikey, candidate_key_damaged (exit 1): that file in the creds dir is damaged. Fix: remove or repair it - no_credentials (exit 1): no key in the creds dir. Fix: nanovm login ID SECRET_HEX - creds_locked, invalid_creds_dir, creds_write_failed (exit 1): the creds dir is locked, is not a private absolute 0700 dir, or cannot be written. Fix: wait, or mkdir -p -m 0700 DIR; check permissions and disk space - file_too_big, file_unreadable, request_too_long (exit 1): Body > 32 MiB or secret > 1024 bytes, a file cannot be read, or a header, body or path is too long. Fix: shrink it, check the path, shorten the request - no_server, invalid_url (exit 1): no server URL, or --url is not IP:PORT. Fix: --url IP:PORT or export NANOVM_URL - out_of_memory, entropy_failed, signup_no_key, generation_missing (exit 1): free memory, /dev/urandom failed, the sign-up answer had no key, or the app's answer had no generation. Fix: retry; nanovm deployments APP shows the app's versions - internal_error (exit 1): a local failure with no code of its own; the message keeps the original text. Fix: read it, then report a bug - pack_failed (exit 1): the directory or archive could not be packed; stderr has the reason. Fix: fix what it names, then deploy again - no_account (exit 4): this SSH key has no account. Fix: signup [INVITE] - account_exists, door_has_account (exit 4): this SSH key already has an account, and a door's key is never replaced. Fix: use apps or deploy; `keys create` and `login` from another SSH key attach a key; `tenant` shows the account - invalid_invite (exit 4): the invite is not -. Fix: provide a valid invite - missing_source, no_input (exit 4): no source on stdin; over SSH, no_input (exit 4) if nothing arrives on stdin for 30 s (the door does not wait forever while holding the key's lock). Fix: deploy APP < app.js, or send it with < FILE - missing_name (exit 4): an archive needs the app's name. Fix: deploy APP < site.tar - command_too_long (exit 4): the SSH command is too long. Fix: shorten it - first request failed (exit 3): the new version's first request answered 5xx; the app's log lines are printed and "first" holds the status, and "error" the thrown error's first line when the runtime caught it (a runtime TypeError names what was called, as Node does: "crypto.nope is not a function"). (An auth.require(req) 401 with no session is exit 0, not exit 3: "first" holds status 401 and "note": the app asks for sign-in and a browser goes to /login.) The version it replaced serves again ("status":"rolled_back", "serving"); a first version stays live. Fix: fix the code and deploy again ### Server Error Codes - unauthenticated (401): bad signature, missing auth, an unknown or revoked key, or X-NV-Date outside +-5 min. Fix: sign with a live key and the clock in the window - forbidden (403): the key's role cannot do this (a reader deploy, a non-owner data read). Fix: use a key with the role the route needs - invalid_invite, invite_required, pro_only (403): the invite's tag is wrong, open sign-up is off, or a custom domain or backups is part of Pro (every app already has its own url). Fix: use the invite the server printed; nanovm upgrade starts Pro - not_found (404): no such app, version, key, secret, data key, or name in this account; also this server does not build apps, has tree deploy off, keeps no logs, has no paid plan, or reaches no app data. Fix: check the name; for those six ask the operator - not_available (404): email verification is off on this server: nothing was sent. Fix: tell your human this site has no mail - no_billing (404): this account has never paid. Fix: nanovm upgrade starts Pro - method_not_allowed, write_only (405): the wrong method on a known path, or a read of secrets. Fix: use the documented method; write secrets, never read them - already_verified, email_taken (409): this account verified another email and keeps it, or that email verified another account. Fix: nanovm tenant shows "email":"verified" if this account is; one email verifies one account - conflict (409): If-Match is not the current generation, the Idempotency-Key is older, the name or version is taken, or the app was deployed while its secret was written. Fix: read the generation for If-Match; for a name or slot take a new name or Idempotency-Key; for the secret race run the command again - idempotency_key_reused (409): that Idempotency-Key named a different request. Fix: take a new key - invite_used (409): the invite was already redeemed. Fix: obtain a new invite - name_taken (409): a nameless deploy's generated name belongs to another app. Fix: retry with a new Idempotency-Key - nothing_older, app_deleted (409): no older version to go back to, or a promote or rollback of a deleted app. Fix: deploy a new version, or deploy it again to bring it back - domain_taken (409): another account has that hostname and it is served for them. Fix: nanovm domain rm HOST in that account first, or use another hostname - version_gone (409 or 410): the version went with its app, or is older than the last 10 versions. Fix: deploy the source again - apps_full (413): the account has its tier's apps at a time: 2 unverified, 5 with a verified email, 10 with Pro. Delete one and the room is freed at once, or deploy a new version of one it has; bringing a deleted app back needs room like a new app. Every app also takes a number that is never reused (16 at most). Fix: ask your human for an email and run `nanovm verify EMAIL` (5 instead of 2), or run `nanovm upgrade` (10 with Pro); at 16 numbers, deploy a new version - domains_full (413): the account has named all 10 custom domains it may ever have; a place is never given back. Fix: use a hostname it already holds; a domain removed before can be added again - keys_full (413): every key id is used (3 an account, on every tier), and an id is never reused. Fix: nanovm keys revoke ID; an id is not given back - too_large (413): the request body is over 32 MiB, a static tree over 27 MiB as an archive (its files at most 25 MiB in all, plus tar headers), or the compiled image is too large. Fix: make it smaller; about 6 MB of source deploys - full (413, or the in-band full: from db.put or kv.put): the root group's table, a name's pending and app secret sets hold 17 entries (16 allowed), or a store every account shares is out of room. Fix: for a secret set delete one with `nanovm secret delete APP NAME`; for a shared store delete keys; for the root ask the operator - compile_error (422): the compiler rejected the source; its diagnostic is the message. Fix: fix the code and deploy again - if_match_required (428): a mutation needs If-Match: . Fix: read the generation and send it - slow_down (429): a sign-up, deploy or data rate limit was reached, or a request was past the account's inbound limit. Fix: wait retry_after_s, also the Retry-After header - rate_limited (429): 5 verify links an account and 3 an address a day. Fix: use the link already sent, or wait the minutes the message names - too_many_readers (429): 4 log followers or 2 data readers are open for the account. Fix: close one, then retry - internal_error (500), error (500, 503 or 504): a name could not be generated, a record does not decode, an answer is too long, or a dependency answered unexpectedly; error is the generic fallback. Fix: retry once; if it repeats, tell the operator - checkout_failed, portal_failed (502): Stripe did not make the checkout or billing link. Fix: retry nanovm upgrade or nanovm billing later, or tell your human - unavailable (503, or the in-band unavailable: from db.put or kv.put): a dependency is down and the message names it: root, S3, compiler, payment, mail or meter. Fix: retry where it says so (a mutation: the same Idempotency-Key); otherwise tell the operator - no_room (503): every open sign-up tenant is taken. Fix: contact the operator, or try again later - logs_unavailable (503), data_unavailable (200 on an export line, 503 otherwise): the log service or data plane did not answer, or its answer was malformed. Fix: retry; a db export that fails mid-stream is a 200 with a data_unavailable line: continue with after= - busy (503, or the in-band busy: from db.put or kv.put): a data table or the account's share is busy; "not applied" means a plain retry is safe. Fix: retry when it has room - warming (503): a deploy retry found its version committed but the pool is not ready. Fix: retry the same source - outcome_unknown (504): the root group timed out; the command may have applied. Fix: retry with the SAME Idempotency-Key (a deploy: the same source) - invalid (400): a malformed body, path, name or number; version too large (over 64); a non-Stripe body to /v1/stripe; or a signature that does not check. Fix: send the body the route documents; for version 64 delete the app (nanovm delete APP) and deploy again - idempotency_key_required (400): a mutation with no key. Fix: send an integer that increases per key - version_limit (400): an old-layout app holds its last version (64). Fix: nanovm delete APP, then deploy again - quota (in-band, thrown by db.put, db.cas or kv.put): your account's share of a db group or kv is used. On nma.sh db: 10,000 keys and 40 MiB of values an account, as 5,000 keys and 20 MiB in each of its 2 groups (a key's group is its hash; a group holds 24,576 keys and 96 MiB across accounts); kv: 600 keys an account of 3,072 shared slots (3,071 keys after the first delete reserves one version-floor slot). Keys are at most 512 bytes, values 64 KiB. When Pro gives more the message ends with its price and `nanovm upgrade`; give your human the link. Fix: db.delete gives the value's bytes back at once, but not the key (rewrite the same key free, a new one is not); kv.delete gives both back; reuse key names - unknown (in-band): no replica answered in time or a resend was refused; e.outcome is "unknown" and the write may have applied at most once. Fix: read the key with db.get before writing it again; two writes are not a retry - crdt, db, db LIST, db PUT, db list, kvs, kvs LIST, kvs PUT, stale (in-band): a protocol diagnostic, not a stable code; the message names the bad op, cursor, prefix or limit. Fix: correct the call; a stale write id means read again - exec_failed, mcp_timeout, mcp_child_failed, pack_failed (MCP tool errors): nanovm is not on PATH, the call stops after 300 s (its outcome is unknown), the child failed before answering, or the packer refused with its reason. Fix: fix what the message names; read deployments before retrying a deploy - JSON-RPC errors (-32600, -32601, -32602): an invalid envelope or a request before initialize, an unknown method, or a bad tool name or arguments. Fix: send initialize, then tools/list for the schema