---
title: "turnzero command input and output"
description: Look up the files, settings, and responses each turnzero command reads, the output it prints, and how to interpret its exit status.
slug: /concepts/what-the-turnzero-command-reads-and-prints
order: 13
visibility: public
redirects_from: [/concepts/the-turnzero-commands-options-and-output, /concepts/the-turnzero-cloud-commands-options-and-output, /concepts/turnzero-command-input-and-output]
---

# turnzero command input and output

The CLI reads application files, local settings, and platform responses. Its output reports what it checked or changed and how the command ended. See [The turnzero command](/cloud/concepts/turnzero-command/) for common workflows and the [CLI reference](/cloud/reference/turnzero-command/) for options and exit statuses.

## What it reads

- **Application folder.** A server ZIP needs `package.json` at its root. A serverless ZIP can omit it. The CLI refuses included symbolic links or more than 65,535 files. A `.deployignore` at the folder's top leaves the paths it lists out of the ZIP. The top `.gitignore` is read only to name, on a `note:` line, included files it lists. See [What the deploy ZIP holds](/cloud/concepts/what-the-deploy-zip-holds/).
- **`manifest.json`.** Before zipping, `turnzero deploy --origin https://dev.turnzero.ai` and `turnzero check --origin https://dev.turnzero.ai` compare its `application` field with `--application`. An invalid or different ID causes status 3 before any upload. If the field is absent, deployment writes it when proceeding to upload; `turnzero check --origin https://dev.turnzero.ai` does not. `turnzero hash --origin https://dev.turnzero.ai` rejects invalid IDs but has no application to compare. A prebuilt ZIP supplied through `--path` is not checked for this binding.
- **ZIP contents.** Unchanged files produce the same ZIP bytes on the same Node.js version. A prebuilt ZIP is uploaded unchanged.
- **Git commit.** For a folder in a Git repository, `turnzero deploy --origin https://dev.turnzero.ai` reads the checked-out commit directly from Git's files; Git need not be installed. The platform records that commit with the deployed version. It does not describe uncommitted changes. No commit is sent for a prebuilt ZIP or when the commit cannot be read.
- **Named files.** `secret` reads `--value-file`; `put` reads `--path`; `provision` and `run` read the environment file. `library take` reads `system.json`, the library folder and its manifest, and the application's package and manifest files.
- **`TURNZERO_DEPLOY_NO_WAIT`.** A nonempty value makes deployment return after starting. Use `read_status` to get the outcome.
- **Platform compatibility.** Before its first platform request, the CLI reads `/healthz` without credentials or redirects. An API contract version the command does not support causes status 3 before further requests. A failed or incomplete health read does not stop the command. Commands that send no request, and `logout`, skip this read.
- **`TURNZERO_CLOUD_USER_AGENT`.** Its value is appended to `turnzero/<version>` in the request's user agent. Only printable ASCII is accepted; other characters cause status 3 before a request.

Credential sources are described in [The turnzero command's credential](/cloud/concepts/how-the-turnzero-command-finds-its-credential/).

### Command options

Use `--name value` or `--name=value`. Unknown commands, actions, or options cause status 3 and a usage message. `turnzero --help` summarizes commands; `turnzero deploy --origin https://dev.turnzero.ai --help` shows that command's options and an example. `--version` prints the CLI version.

`--origin` accepts an HTTPS origin without a path, or an HTTP origin on the local computer. Hostnames contain letters, digits, dots, and hyphens; IPv6 addresses use brackets.

On Windows, avoid `&`, `|`, `<`, `>`, and `^` in paths passed through `turnzero.cmd`: PowerShell can remove quotes from a path without spaces, leaving cmd to interpret those characters. The CLI removes one surrounding pair of double quotes, then rejects Windows paths that still contain a double quote. A common cause is a quoted path ending in a backslash; omit the trailing backslash.

`secret --value-variable` cannot name `TURNZERO_CLOUD_MINTED_TOKEN` or `TURNZERO_CLOUD_UPLOAD_GRANT`, regardless of letter case.

### The environment file

`provision` writes `.env`, or the path supplied through `--settings-file`; `run` reads it. The filename must be `.env` or start with `.env.`, so deployment excludes it.

Provisioning checks that it can write the settings file before rotating credentials. It writes a temporary file beside the target and renames it into place. A failure before the rename leaves the existing file unchanged.

If the file write fails after the platform credential was re-minted, the old value is revoked. If the database credential was also re-minted, the old connection setting no longer works. Read the command's outcome before retrying. Provisioning removes temporary files on failure or interruption. Deploys leave those files out.

Credential values are not printed; output shows their character counts. Each rotation request is made once, since a lost response may still mean the rotation succeeded.

The environment file accepts:

- `NAME=value`, with optional surrounding spaces, tabs, and an `export` prefix. Names begin with a letter or underscore and continue with letters, digits, or underscores.
- Comment lines whose first non-whitespace character is `#`.
- Blank lines.

It is UTF-8. A leading byte-order mark and CRLF line endings are accepted. A repeated name uses its last value. Values are trimmed and lose one matching pair of surrounding single or double quotes. Nothing else is interpreted: an inline `#` remains part of the value.

Invalid environment-file syntax stops `run` with status 3. Without `package.json`, it can still serve a folder with `client/` or `functions/`. A missing environment file supplies no settings; values can still come from the shell.

### The cookie file

`session` writes the path named by `--out`. Before any request, it checks that the parent folder exists and refuses an existing file unless `--force` is supplied. It also refuses a destination inside the current application folder when that folder contains `package.json`, preventing accidental deployment of the cookie.

The command writes a temporary file and renames it into place. On macOS and Linux it restricts access to the user; on Windows the destination folder's permissions apply. Use a private folder.

The file uses the Netscape cookie format accepted by `curl -b`. Its fields record the hostname, subdomain flag, path, HTTPS flag, expiry, name, and value. HttpOnly cookies use the `#HttpOnly_` hostname prefix. The cookie value is not printed.

## What it prints

Each run starts with:

```text
turnzero <version> (Node.js <version>)
```

`--help` and `--version` have their own output. Under `token claim` and `deploy --json`, the version line goes to standard error, so standard output contains only the token or the result object.

Scripts should use the exit status and stable output prefixes such as `zip:`, `settled:`, `checked:`, `refused:`, `reference:`, and `warning:`. Explanatory wording after a prefix can change. A deployment script can read one JSON object instead; see [Deployment result as JSON](#deployment-result-as-json).

### ZIP preview and warnings

`hash` prints `sha256:` followed by 64 lowercase hexadecimal characters. Without `--list` or warnings, its only output is the version line and the hash line. With `--list`, it also prints each included file's byte count and full path, escaping invisible characters.

`turnzero hash --origin https://dev.turnzero.ai`, `turnzero check --origin https://dev.turnzero.ai`, and `turnzero deploy --origin https://dev.turnzero.ai` report excluded files and warnings when relevant:

| Output | Meaning |
| --- | --- |
| `left out:` | Excluded paths, up to ten followed by the remaining count |
| `warning:` for ZIPs or local output | Root ZIPs, `.log`, `.pid`, `.err`, `.tmp`, and `nohup.out` files are included; move them out unless the app needs them |
| `warning:` for credentials | An included file looks like a key or credential; move secrets out and use `store_secret` |
| `warning:` for disk writes | Source code appears to write into the application folder, whose contents are lost when the running copy is replaced or stops |
| `note:` for `.gitignore` | Included files the top `.gitignore` lists, each with its pattern. This is expected; no action is needed unless a file must stay out. List a path in `.deployignore` to leave it out |
| `warning:` for the health path | No included file appears to implement the manifest's health path |

Excluded-file and warning lists show at most ten paths in order, followed by the remaining count. A path longer than 80 characters is printed cut short.

The disk-write check inspects JavaScript and TypeScript text, skips root `client/` and `lib/`, and ignores paths from settings or `os.tmpdir()`. The health-path warning is also a text check; dynamically constructed routes may work despite it. First-deploy validation can refuse a missing health path before upload. See [Choosing the health path](/cloud/guides/author-the-manifest/#choosing-the-health-path).

After a health-path warning or refusal, the CLI can name the shortest quoted source path containing `health`. This diagnostic has no output prefix and begins `The zip's source names the path`.

Warnings do not block upload. If a deployed file contains a real secret, replace the secret, remove the file, and deploy again: the old deployed version retains its ZIP.

### Deployment output

Before its `zip:` line, `turnzero deploy --origin https://dev.turnzero.ai` checks the application with `check_deploy`. The command prints nothing for a successful application check. On refusal it prints the same refusal lines as `check` and exits with status 3 before building the ZIP.

A normal `turnzero deploy --origin https://dev.turnzero.ai` reports these stages:

| Prefix | Meaning |
| --- | --- |
| `zip:`, `sha256:` | File count, byte count, and ZIP hash |
| `files:` | Up to ten top-level entries, followed by the remaining count; omitted for a prebuilt ZIP |
| `prepared:` | Upload ID, target environment, and grant expiry |
| `binding:` | Printed just before the CLI adds the application ID to a manifest that has none: the file, the ID, and why later commands for another application are refused |
| `bound:` | The CLI added the application ID to the local manifest; it also says to commit `manifest.json` with your change; a failed write is reported without stopping deployment |
| `uploading:` | The same byte count and upload ID, printed as the upload begins |
| `uploaded:` | Uploaded byte count and upload ID |
| `started:` | Platform response, including `health_path` and the next `read_status` call |
| `notice:` | A nonempty text notice from the start's answer, as `notice: <member>: <text>`. Members end in `_notice`. Each prints on one line after `started:`, in the answer's order. Notices change no exit status |
| `step:` | Deployment step, elapsed time, and duration of the previous step |
| `waiting:` | No new progress after at least 25 seconds |
| `settled:` | Deployment succeeded, or the step and error that failed |
| `checked:` | Health and smoke checks performed, or that none ran; request untested pages or routes yourself |
| `address:` | The deployed version's address, `https://<hostname>/`, the deployment's own last line after a successful deployment; an update notice may follow it |

`prepared:` appears only when the run proceeds to upload. In `files:`, folder names end with `/`. After at least 25 seconds without progress, each progress read prints `waiting:` with the seconds since the last progress line.

Step elapsed time is counted from deployment start; later step lines also give the previous step's duration. After a successful deployment, request the other routes you rely on, check `read_status`'s `server_errors`, and read `read_logs` for errors.

The progress ends with a line that gives a `read_status` call for the complete record. After a successful deployment, `address:` follows it as the deployment's own last line. A notice that a newer `turnzero` is available may print after it. Failed health or smoke checks print their evidence, not application console output. Read `read_logs` for that output.

Before a first upload, the CLI checks whether source files name the manifest's health path. A refusal prints `Nothing was uploaded and nothing was started.` and exits with status 3, without `prepared:`. Its diagnostic begins `No source text in the zip names the health path`.

Allow up to fifteen minutes after deployment starts, plus upload time. If the AI tool cannot wait that long in one shell call, run the command in the background and collect its output. A nonempty `TURNZERO_DEPLOY_NO_WAIT` returns after startup; then use `read_status`.

Progress polling allows up to 450 reads, each bounded at 60 seconds, with a two-second pause after a read with no new progress. HTTP 502, 503, or 504 retries a progress read after 2, 4, and 8 seconds, within that read limit. Continued failure ends the wait with status 2; the deployment may still be running.

The start request is never repeated automatically. An upload is retried only for 503 `credential_lookup_busy` with `Retry-After`: wait up to five seconds and retry at most twice. That refusal guarantees nothing was written.

If `--env` is omitted, the target is the environment returned by preparation. The platform checks whether the upload grant allows deployment to that environment. A refused start leaves the uploaded ZIP stored and exits with status 3; retry the command after addressing the refusal.

### Deployment result as JSON

`turnzero deploy --origin https://dev.turnzero.ai --json` prints every line above on standard error, with the version line and any update notice. Standard output then holds one JSON object, printed when the run ends, whatever its status. The exit status is the same as without `--json`.

```json
{"contract_version":1,"status":0,"outcome":"deployed","application":"<application id>","environment":"development","upload":"<upload id>","version":2,"address":"https://<label>-dev.ai.host/","failed_step":null,"error":null}
```

`outcome` is `deployed`, `failed`, `unknown`, or `nothing_started`, for exit status 0, 1, 2, or 3. With `TURNZERO_DEPLOY_NO_WAIT` set, status 0 is `started`, since the run returns once the deployment starts. `failed_step` and `error` name the step and error of a failed deployment, or the error of a refusal or of a failed platform answer. A value the run did not reach is `null`.

### Check output

After its local checks pass, `check` prints `checking: application <id>: platform readiness, then checks of the files in the zip.` before any request. It reads the platform's health response, then makes the application check. The command builds the ZIP and prints its summary and warnings only if the application check succeeds. A refused application check ends with status 3, without building a zip or printing a `zip:` line.

Its check results use these lines:

- `refused:` for each application-state or ZIP refusal.
- `manifest:` if the ZIP's health path differs from the recorded manifest; submit the changed manifest before deploying.
- `note:` for an old or unreadable Database package copy in the ZIP that a deploy may refuse. At most one such note is printed, after any `refused:` and `manifest:` lines and before `checked:`. It counts as no refusal and does not change the check's exit status.
- `checked:` with the refusal count split between platform readiness and checks of the files, or confirmation that both passed. A passing line also says a later deploy repeats every check.

If either `turnzero deploy --origin https://dev.turnzero.ai` or `turnzero check --origin https://dev.turnzero.ai` finds no credential, it sends nothing and exits with status 3 after printing authorization options. `turnzero check --origin https://dev.turnzero.ai` also suggests `turnzero hash --origin https://dev.turnzero.ai` to inspect local ZIP warnings without a credential. That command does not run the platform's deployment checks. A refused check also prints `Read more: <address>`; read that page for the next step ([Refusals and exit status](#refusals-and-exit-status)).

### Other commands

`turnzero db connect` starts the tool named after `--`. With `--grant`, it reads the pending action ID for production. With `--environment development`, it reads `APP_DATABASE_DIRECT_URL` from the environment file written by `turnzero provision --origin https://dev.turnzero.ai`. It reads `.env` in the current folder unless `--settings-file` names another file.

It supplies PostgreSQL settings to the tool, keeps the connection string and password out of command output, and returns the tool’s exit status. The development form reads no platform token, sends no platform request, and needs no approval. [Connect to your database](/cloud/guides/connect-to-your-database/).

For production, if the platform refuses authorization, the command reports the refusal before starting the tool. If a running connection ends early, read the tool's error and check what completed before requesting another approval.

- **`turnzero promote --origin https://dev.turnzero.ai`:** Prints the platform's summary and detail, then `reference:` when supplied. A `next:` line names `tzcloud_read_status` if the promote is still running.

- **`secret` and `put`:** See [Keep a secret value out of chat](/cloud/guides/supply-a-secret-value-without-exposing-it/#what-the-command-reads-and-prints) and [Store files](/cloud/guides/store-files/#an-upload-grant-from-your-tool).
- **`export download`:** `export:` describes the export; `escaped:`, `moved:`, and `failed:` describe file outcomes. `waiting:` indicates throttling. `downloaded:` totals completed, existing, moved, failed, and unread files. An incomplete run prints how to continue.
- **`library take`:** A `reading:` line first gives the entry, its version, and its count of files. Where the command makes `app/package.json`, one line then says that no `package.json` is at the project's root or in `app/`, so the application goes in `app/`. `taken:`, `copied:`, and `installed:` describe the entry and compiled modules. `made:` reports a new package file. `packages:` reports manifest updates or tells you what to copy. A new manifest requires service and audience declarations before `submit_manifest`. If `npm install` succeeds but `node_modules/@turnzero/<name>/package.json` is unreadable, the command says so and runs `npm install --install-links` once there, replacing links with local copies.
- **`provision`:** Prints settings with credentials shown only as character counts, then database information and a `next:` command. Without a credential, it prints a `submit_manifest` call and the challenge for this computer. The challenge comes from the [verifier](/cloud/concepts/how-the-turnzero-command-finds-its-credential/) saved on the computer. This first step writes no settings file. A successful claim or a successful run with a credential writes the file. Under `--claim`, a missing grant prints that challenge again. In CI without a credential, it exits with status 3.
- **`scaffold`:** First prints the line `library take` prints before it makes `app/package.json`. Where a `package.json` is at the root, that line says instead that the new application goes in `app/` beside it. Then prints the selected default template when `--template` is omitted, each `written:` file, library-download and npm output, `installed:`, `tested:`, and numbered next steps. If a taken entry's package file cannot be read through its link after `npm install` succeeds, the command says so before running `npm install --install-links` once, then reads the entries again. An unreadable link after that install ends the run failed, without tests.
- **`login --device`:** Prints a `link:` line and a sentence for the person. It waits for browser approval on any device, then stores this computer's token and prints `authorized:` ([Sign in without a terminal](/cloud/concepts/how-the-turnzero-command-finds-its-credential/#sign-in-from-an-ai-tool-without-a-terminal)). After `authorized:`, the command prints a sentence with two full URLs. One explains what this computer's token can do on its own. The other lists commands you or your AI coding tool can run.
- **`login` without `--device`, `authorize`, `logout`, `token`, and `whoami`:** See [This computer's token](/cloud/concepts/how-the-turnzero-command-finds-its-credential/#this-computer-s-token).
- **`session`:** After saving the cookie file, prints the application hostname, end-user label or ID, expiry, cookie name, and file path. It does not print the cookie value.

### Local-run output and stopping

Before application output, `run` reports the folder, process ID, how to stop it, setting names, any environment-file overrides, and the port's source: `--port`, environment file, or shell. Only the port value is shown. A valid port from 1 to 65535 also produces a localhost URL. Without `PORT`, the application chooses its port.

With `--sign-in`, or with `client/` and a numeric port, the port line names the command's address and the application's port behind it. Open the command's address. A sign-in line names the hosted hostname; a client-files line says files are read on request, ahead of your routes.

With `client/` but no numeric port, a note says the application runs as started. The command serves no client file in that run. Use `--port` if the application serves none itself and you need the command to serve them as the platform does. Under `--sign-in`, a missing numeric port refuses the run before the application starts.

Application output passes through with known credentials replaced by setting names in angle brackets. Redaction covers the platform token, database URL, and passwords in connection strings, including percent-decoded passwords. Values shorter than eight characters and values printed in another format are not covered. Keep secrets out of application logs.

`run` normally returns the application's exit status; a signal gives 128 plus its signal number. If no application starts, it returns status 3. On Windows, npm or cmd can determine the final status after an interrupt.

On Windows, if `run` finds no npm entry file and `PATH` is set, it checks the application folder and `PATH` using `PATHEXT`. If that check finds no npm, it prints this line:

`npm start could not be started (ENOENT): npm stands beside Node.js and must be on the PATH. No application was started.`

It ends with status 3 before starting a shell or the application.

On macOS and Linux, npm and its children run in a process group. Interrupt, termination, and hang-up signals reach the group; a second interrupt becomes termination. The CLI waits for the application to end.

On Windows, the console delivers interrupts. After `turnzero.cmd` or `npx.cmd` exits, cmd may ask `Terminate batch job (Y/N)?`. Either answer returns the prompt; `N` preserves the command's status, while `Y` uses cmd's. If an AI tool forcibly ends a process without a console interrupt, it must end the process tree to avoid leaving the application running. See [Start the application](/cloud/guides/run-your-application-on-your-machine/#3-start-the-application).

### Refusals and exit status

Read the exit status immediately after the command: `$?` in bash or zsh, `$LASTEXITCODE` in PowerShell after `turnzero.cmd`, or `%ERRORLEVEL%` in cmd. A PowerShell process started with `-Command` reduces nonzero statuses to 1, so read `$LASTEXITCODE` inside it.

A platform refusal prints `<step> refused (HTTP <status>): <error>`, followed by the platform's explanation. A platform failure prints `<step> failed`. Invalid command options are named without echoing their supplied values. Where a refusal or failure carries a reference of ten lowercase hexadecimal characters, `reference: <reference>` follows its error and detail lines.

After a run ends with status 1 or 3, `Read more: <address>` names the page to read for the next step. It follows the refusal's own lines and precedes update notices. The whole address has no period after it. It uses the run's origin when that is a Turn Zero platform origin, and production otherwise.

A missing credential or refused origin points to the credential page's matching section. Otherwise, the line names the subcommand's page. An unrecognized command line points to [Running and writing lines](/cloud/concepts/turnzero-command/#running-and-writing-lines) on production. An empty command line, local listener commands, a run ended by a signal, and `run` after the application starts print no such line.

Outside storage routes, HTTP 400–499 responses without `contract_version` are treated as responses from an intermediary. The command prints `The <step> was answered HTTP <status>, not by the platform.` and nothing of the answer's body. The command stops at that step. A deploy exits with status 3 before the start request, or status 2 from the start request onward. If deployment may already have started, it says so.

Except for `rate_capped`, a refusal of the application check or the call that prepares the upload identifies whether the CLI used the computer token or `TURNZERO_CLOUD_MINTED_TOKEN`. An application of another account, or none, is refused before the zip, under the step `check`. For `no_such_application` under the computer token, it also names the account. `application_other_account` names only the requesting account. Compare `turnzero whoami --origin https://dev.turnzero.ai` with the MCP connection's `read_account` result when they disagree.

For `rate_capped`, wait as directed before retrying. For `command_too_old`, run the suggested update command and retry.

## Related

- [The turnzero command](/cloud/concepts/turnzero-command/)
- [The turnzero command's credential](/cloud/concepts/how-the-turnzero-command-finds-its-credential/)
- [CLI reference](/cloud/reference/turnzero-command/)
- [What the deploy ZIP holds](/cloud/concepts/what-the-deploy-zip-holds/)
- [Run your app on your computer](/cloud/guides/run-your-application-on-your-machine/)
- [Deploys troubleshooting](/cloud/troubleshooting/deploys/)
