drift Docs
Start
What is Drift?
The tour, if you are new here.
Use cases
Whether Drift does your thing.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, four unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Route gates, API keys and your account.
Teams
More than one person on one account.
Security
Boundaries, sandboxing and hardening.
Troubleshooting
Error codes
What went wrong, and what to do about it.
Legal
Acceptable use
What a slice may not be used for.
Data processing
The DPA, and every sub-processor.

Error codes

Every message the CLI prints starts with what it was trying to do, like Couldn't create slice: … or Couldn't deploy atomic function: …, and ends with the reason. This page is the reasons: what produces each one, and what to do about it.

The CLI does not invent an error surface for the platform. It renders the status the platform returned plus whatever the platform said about it, so if you see a sentence that is not here, it came from the platform verbatim and means what it says. The messages about your Driftfile are the CLI's own, and they are on this page.

A message built from an HTTP status also carries a stable code on its own line beneath it, like DRIFT-1006 · drift doctor explain DRIFT-1006. drift doctor explain <code> expands any of them into the full meaning and the remedy, and drift doctor codes lists every one this binary knows. Both work offline and without a session, which is exactly when you are holding one. A code is minted once and never reused or renumbered, so one pasted from a chat log a year old still resolves to the same failure.

Before the request lands

These happen on your machine or on the wire. No slice was touched.

What you seeWhat it meansWhat to do
  • DRIFT-1007
    What you see
    couldn't reach the Drift API (timed out). Is the platform up?
    What it means
    The request left and nothing came back inside the timeout.
    What to do
    Check your own connection first. If that is fine, the platform is likely mid-restart, so try again in a minute. A deploy that timed out may still have landed: drift plan shows what the slice holds before you apply again.
  • DRIFT-1006
    What you see
    couldn't reach the Drift API. Is the platform up? followed by the underlying error in parentheses
    What it means
    DNS did not resolve, or the connection was refused outright.
    What to do
    Nothing reached Drift at all. A proxy or a firewall between you and api.ondrift.eu is the usual cause.
  • DRIFT-1012
    What you see
    Drift is temporarily unavailable — most likely brief maintenance. Your login is still valid; nothing to do but try again in a few minutes.
    What it means
    The platform answered with a 502, 503 or 504. It is up but not serving.
    What to do
    Wait. Do not log out. Re-authenticating needs the same platform, so logging out here turns a short wait into a lockout.
  • DRIFT-1005
    What you see
    the platform is having trouble. That's on us; give it a moment and try again.
    What it means
    A plain 500: the platform hit a fault handling the request. Not maintenance, and not caused by anything you did.
    What to do
    Retry once. If it keeps happening, check status.ondrift.eu and report it. This one is a bug, not a busy period.
  • none
    What you see
    this machine has no copy of the Driftfile format yet, so it cannot be validated
    What it means
    drift file lint, drift plan and drift apply have never fetched the schema, so they have nothing to validate against. drift doctor explain 1008 describes it.
    What to do
    Run any online command once, such as drift account login or drift slice list, and it caches permanently at ~/.drift/driftfile.schema.json.

The registry also names three failures that are not HTTP statuses: DRIFT-1009 (the Driftfile is not valid; drift file lint reports every problem at once), DRIFT-1010 (a compiled function booked less memory than its language runtime needs; the fix is drift size) and DRIFT-1011 (you are not logged in, so the CLI has no credential to send, which differs from an expired session). drift doctor explain expands each.

"Unavailable" never names a component.

A slow store, a restart and a configuration change are the same event from outside, and which one it was is Drift's problem rather than yours. The message says to wait because waiting is the whole of the correct response.

Your account and session

CodeWhat you seeWhat it meansWhat to do
  • 401
    Code
    DRIFT-1001
    What you see
    your session expired. Run 'drift account login' to re-authenticate.
    What it means
    Your token is no longer valid.
    What to do
    drift account login.
  • 401
    Code
    none
    What you see
    invalid username or password.
    What it means
    Only on drift account login itself.
    What to do
    Check the credentials. Ten attempts a minute from one address are allowed; past that, the answer is DRIFT-1014 below.
  • 403
    Code
    DRIFT-1002
    What you see
    you don't have permission to do that.
    What it means
    You are authenticated, and this is not yours.
    What to do
    Usually a slice belonging to another account. drift slice list shows what you can reach.
  • 409
    Code
    DRIFT-1013
    What you see
    that conflicts with existing state.
    What it means
    You asked for something that collides with what already exists.
    What to do
    The message names the conflicting thing when the platform supplied one, most often a second free slice (one Hacker grant per account; a second is allowed, but priced) or a name already taken. drift slice list shows what you have.
  • 429 with a wait
    Code
    DRIFT-1014
    What you see
    the platform's reason, then This clears by itself; try again in 60 seconds.
    What it means
    A rate limit, not a quota: too many logins or signups from one address in a minute, too many control-plane calls from one account in a minute, a restart inside its cooldown, or too many transfer offers in a day.
    What to do
    Wait for the time it names, then run it again. Nothing needs freeing or buying, and resizing does not lift it. Retrying sooner is refused again.
  • 402 or 429
    Code
    DRIFT-1004
    What you see
    you're at your plan limit. Run 'drift slice resize' to add capacity.
    What it means
    Some resource exceeds what the slice booked.
    What to do
    The message names the resource and, when the platform supplied them, how much of it is used. Raise that figure in the Driftfile (a booking, a size or a limits entry) and drift apply, or for a slice without a file, drift slice resize.

Deploying a project

Most of these are found offline, before anything is built or uploaded. drift file lint reaches all of them without an account, and drift plan and drift apply run the same checks first.

A Driftfile error names the file and the position, Driftfile:12:5: <summary>: <detail>, and a file's errors are all printed at once, top to bottom, so one pass fixes them all. A failure to find the file at all reads no Driftfile in the current directory, followed by the path it looked in and a line naming drift file new, the command that writes one. Long messages are quoted here by their first sentence; the rest of each message explains the same thing at more length.

What it meansWhat to do
  • Driftfile:5:3: Missing handler: function "GET /items" names the callable that serves it
    What it means
    A function or worker block has no handler.
    What to do
    Add handler = "GetItems". See Write a function.
  • Driftfile:5:3: Missing memory: function "GET /items" books its memory
    What it means
    Every function and worker states its own booking: it is the slot's pool and what it is billed at, so it has no default.
    What to do
    Add memory = "32MiB". Once the function has served traffic, drift size rewrites it from what the slice measured.
  • Driftfile:7:14: Not a size: function "GET /items": memory "64MB" is not a size
    What it means
    Sizes are a whole number of KiB, MiB or GiB. 64MB is refused rather than guessed at.
    What to do
    Write "64MiB".
  • Driftfile:7:14: Memory out of range: function "GET /items" books 512MiB; a slot books from 8MiB to 256MiB
    What it means
    A booking outside what a slot may hold.
    What to do
    Book between 8MiB and 256MiB (16MiB or more in a compiled language).
  • a compiled function or worker needs at least 16MB, and 1 of these book less, or Below the compiled floor: worker "w" books 8MiB
    What it means
    A compiled language (Go, Rust) carries a private runtime inside every invocation, and a Worker runs Go.
    What to do
    Raise the booking to 16MiB or more, or run drift size against a deployed slice.
  • function "get:items": the Driftfile declares a function served by "getItems", and no such callable is in <dir>
    What it means
    The handler is not in the backend's folder. The error lists the callables that are there.
    What to do
    Usually a spelling or case difference. The message says so explicitly when the only difference is case.
  • function "get:items": "GetItems" is declared in 2 files in <dir>
    What it means
    Two files in one backend declare the same handler. The generated entry point imports by name and cannot pick.
    What to do
    Rename one, or split them into separate backends.
  • the function "get:items" is declared 2 times (in the backend default)
    What it means
    Two function blocks have the same method and route. A booking key is unique across the whole slice, not per backend, so this collides wherever they live.
    What to do
    Method is part of the identity, so GET /items beside POST /items is fine; two GET /items is not.
  • backend "default": <dir> mixes languages (python in b.py, go in items.go)
    What it means
    A backend has one dependency manifest and one runtime, so it cannot be two languages.
    What to do
    Move one language into its own folder under atomic/ and declare its functions in a backend block of that name.
  • backend "empty": no source files in <dir>
    What it means
    The file declares functions in a directory that holds no code.
    What to do
    Check the backend's name and dir against where the handlers actually live.
  • Driftfile:8:11: Not found: function "GET /items": dir: nowhere does not exist, or site "/": dir: nosuch does not exist
    What it means
    A dir points somewhere that is not on this machine.
    What to do
    A schema cannot check paths; only your laptop can. Fix the path.
  • Driftfile:7:14: Error in function call: Call to function "env" failed: environment variable MEM is not set
    What it means
    A value reads env("MEM") and nothing sets it here.
    What to do
    Set it in the terminal, with --var MEM=..., or in a .env file beside the Driftfile, as the message says.
  • Driftfile:9:17: A secret is a reference: function "GET /items": auth.api_key is write-only and must be written env("NAME")
    What it means
    A secret's value, a function's auth.api_key and a site password are write-only. A literal would be a credential committed with the file, so it is refused, and so are var.x and file(). The message never prints the value.
    What to do
    Write env("NAME") and supply the value at apply time.
  • Driftfile:2:3: billing is gone: a Driftfile no longer says how a slice is paid for. Delete this line: ...
    What it means
    A slice or environment block still has a billing line. The shape decides: one inside the free slice can take one of your free slices, any other is priced.
    What to do
    Delete the line. drift plan says whether the slice would be free or priced, and why.
  • Driftfile:8:16: Written twice: edge.rate_limit and limits.requests_per_minute are one limit
    What it means
    The same limit is set in two places.
    What to do
    Write it in one place.
  • Driftfile:1:1: Unknown environment: there is no environment "qa": the file declares staging
    What it means
    drift plan qa, drift apply qa or --env qa names an environment the file does not declare.
    What to do
    Use one the message lists, or add an environment block.
  • Driftfile:4:1: Variable has no value: variable "x" has no value here
    What it means
    A variable with no default that the environment's vars does not set.
    What to do
    Give it a default, or set it in the environment's vars.
  • Driftfile:5:9: Not a function trigger: function "FETCH /items"
    What it means
    A function is labelled with a method and route, "POST /rpc", or with QUEUE and the queue it drains, "QUEUE orders".
    What to do
    Fix the label.
  • Driftfile:3:3: Unsupported argument: An argument named "colour" is not expected here
    What it means
    A key the block does not take.
    What to do
    drift file explain <block> lists what it does.
  • Driftfile:4:1: Duplicate slice block: one file declares one slice
    What it means
    A second slice block.
    What to do
    Declare one slice per file, and use environment blocks for the others.

Applying has questions of its own. They are all asked, or refused, before anything is sent:

What it meansWhat to do
  • nothing was applied: this plan needs an answer to each of these, and none was given, then flags such as --approve-price 768 and --approve-remove "function GET /bench"
    What it means
    There is no terminal to ask the price, removal or data-loss questions, and none was answered.
    What to do
    Read the plan, then re-run with the flags listed.
  • the platform quotes €7.68 a month for this shape, not the €5.00 agreed to with --approve-price; nothing was applied
    What it means
    The figure you approved is not the figure the platform quotes now.
    What to do
    Run drift plan again and approve the new figure.
  • nothing was applied: secret STRIPE_KEY reads $STRIPE_KEY, which is not set
    What it means
    A secret, an auth key or a site password reads a variable nothing sets. The plan marks it !.
    What to do
    Set it in the terminal, with --var, or in a .env file beside the Driftfile.
  • nothing was applied: the free tier is 3 slices per account and you hold all 3:, then the names
    What it means
    The new slice fits the free slice, and every free slice you may hold is taken. Idle cooldown lowers what an idle free slice costs, but it does not free its slot.
    What to do
    Empty one first (delete it, or give it a shape that is priced), or make this slice a priced one with --approve-price <cents>, as drift plan quotes it.
  • nothing was applied: this plan needs an answer ... with --use-free-slice among the flags
    What it means
    A new slice fits the free slice, you have a free slot, and there is no terminal to ask You have 2 of 3 free slices — make this the 3rd?
    What to do
    Re-run with --use-free-slice, or with --approve-price to make it a priced slice.
  • slice "x" is a free slice and its shape no longer fits the free slice (...), which would make it a priced one
    What it means
    The file grew a free slice past what the free slice grants. drift apply does not move a slice off the free tier yet, so nothing was applied.
    What to do
    Make the shape fit again, or move the slice with drift slice resize.
  • the Driftfile changed after the plan was made (or slice "x" changed after the plan was made, or this plan no longer asks what the recorded one did)
    What it means
    drift apply plan.json applies exactly the plan it recorded, and refuses when anything moved. Nothing was applied.
    What to do
    Run drift plan --out plan.json again.
  • The slice changed after the plan was made, or the platform asks something the plan did not show. Nothing was resized
    What it means
    The platform refused the resize because the answers you gave no longer match.
    What to do
    Run drift plan again.

drift apply creates the slice and resizes it.

It does both from the Driftfile's shape, so there is no slice to make first. What it asks before it does is the price, each removal and each loss of data, and a plan shows all of them without changing anything.

While your function runs

These reach the caller, not your terminal. Read them with drift atomic logs.

What it meansWhat to do
  • 404
    What it means
    No function is registered at that method and path.
    What to do
    A function is identified by method and path, so POST /api/items does not fall through to the GET /items handler. Check the label in your Driftfile.
  • 401
    What it means
    The function has an auth block (or a key set with drift atomic auth set) and the request carried no valid key.
    What to do
    See Authentication. Setting a key on a route protects it whatever the file says.
  • 403 with code EDGE-ALLOW
    What it means
    The slice lists the networks it accepts in allow in its edge block, and the caller is outside all of them. The response carries X-Drift-Refused-By: edge.allow.
    What to do
    Add the caller's range, or call from an admitted network. See The IP allowlist.
  • 401 with WWW-Authenticate: Basic
    What it means
    A Canvas path behind the site gate, and no valid username and password. /api/ and /trigger/ are never asked for it.
    What to do
    Sign in at the browser's prompt, or send the credential as HTTP Basic auth. A 503 site authentication is unavailable means the slice's Deed could not check it; retry.
  • 429
    What it means
    The slice passed its requests per minute, rate_limit, and the router shed the request with {"error":"rate limit exceeded"}.
    What to do
    Raise the limit, or send less. A function whose memory pool has no room for another invocation is a different answer, 503 with X-Drift-Reason: FUNCTION-MEMORY, never a 429: see Limits and alerts.
  • 500
    What it means
    Your handler returned an error, panicked, or exceeded the slice's timeout.
    What to do
    An error or panic is caught and answered as 500 rather than crashing anything visibly. How far the damage is contained depends on the language: Go, Rust, Ruby and PHP each run a call in its own process, so a crash stays with that one invocation. Python and Node are different: one long-lived server per language holds every function written in it, so a crash severe enough to take that server down reaches every function sharing it, not only the one that failed.
  • 502
    What it means
    The function was reached but produced no usable response, commonly a handler returning the wrong shape.
    What to do
    Return (status, message, payload); Go adds a fourth headers value. See Write a function.

Secrets that are not there

A function receives only the secrets its own block names. If drift.Backbone.Secret.Get("X") comes back empty or errors:

  1. Check secrets in that function's block. A secret the slice holds is still unreachable from a function that did not name it.
  2. Check the file declares it with a secret "X" { value = env("X") } block inside backbone, and that the variable was set when you ran drift apply. The plan marks a secret whose variable is missing with !.
  3. Check the value exists, with drift backbone secret list. A secret the slice holds and the file does not name is a removal in drift plan, deleted if you agree to it.
  4. Read it through the SDK, not the environment. DRIFT_SECRET_X exists only on the per-invocation subprocess path; Python and Node functions served by the persistent language server get theirs in the request envelope and no environment variable is set.

Adding a name to secrets needs a redeploy. Changing a value does not, since the runner fetches on every call.

When none of this fits

drift file lint answers most questions without deploying anything or touching the network, and drift plan adds the live slice and still changes nothing. If the message carries a DRIFT- code, drift doctor explain may already answer it, also offline. Otherwise, if it is not on this page, it came from the platform unchanged. Quote it verbatim when reporting, because the wording identifies which check produced it.