> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rivvr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Scripting

> JSON output, structured errors, confirmations, and exit codes for scripts.

Normal output is made for people to read. If a script or another program needs to read it, add `--json`:

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
rivvr model list --project research --json
```

Results are printed to standard output (stdout). Progress messages and errors go to a separate stream, standard error (stderr). That way you can pipe the result straight into a tool like `jq` without the messages getting mixed in.

## Errors as JSON

Even with `--json`, errors are plain text by default. Add `--error-json` to get each error as one JSON object on stderr:

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
rivvr model create hello --storage STORAGE_ID --max-cost-per-hour 3 --json --error-json
```

The error object contains:

* the kind of error,
* the HTTP status,
* Rivvr's error code and correlation ID (give these to support),
* the IDs of anything the command created before it failed.

That last item helps when a command fails halfway: it may already have created something, and the IDs tell your script what.

`--error-json` only works together with `--json`. It also turns off the normal progress messages.

`rivvr deploy` can also print its progress as JSON on stderr. Add `--progress-json`, together with both `--json` and `--error-json`.

## Questions and confirmations

`rivvr` never asks questions when it runs with `--json`, when there's no terminal (for example, in a script), or when the `CI` environment variable is set. Commands that would normally ask "are you sure?", such as deletes, fail instead. Add `--yes` to confirm in advance.

`--yes` only answers "are you sure?". It doesn't fill in missing options, and it doesn't get around permission checks.

## Exit codes

Every command ends with a number. Scripts can check it to see what happened:

| Code | Meaning |
| - | - |
| `0` | Success, or Rivvr accepted the request |
| `1` | Something failed on the server or the network |
| `2` | Wrong options or settings |
| `3` | Not signed in, or not allowed (HTTP 401 or 403) |
| `4` | Not found |
| `5` | Conflict with the current state (HTTP 409) |
| `6` | `--wait` ran out of time |
| `130` | Stopped with Ctrl-C |

## Waiting and retries

Commands that support `--wait` wait up to 30 minutes. Change that with `--timeout`, for example `--timeout 1h`.

Stopping a wait, with Ctrl-C or because time ran out, only stops `rivvr` on your computer. Nothing on Rivvr's side is cancelled or undone. Keep the IDs it printed and follow [recovery](https://docs.rivvr.ai/troubleshooting/recovery.md) before you run the command again.

`rivvr` doesn't automatically retry commands that create something, and it doesn't retry prompts. The one exception: finishing an upload is retried a few times if the error looks temporary.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.