Skip to content

JSON output and errors

Use machine-readable output and process exit codes for automation. Human-readable messages may evolve; JSON codes and structured results are the stable integration surface.

Single-document output

Site, file, and download commands emit one JSON value with --json:

bash
zynohosting sites list --json
zynohosting files list example.com --json
zynohosting download example.com ./copy --yes --json

Errors are written as one JSON object:

json
{
    "type": "error",
    "code": "precondition_failed",
    "message": "file precondition failed",
    "details": {
        "code": "precondition_failed",
        "message": "file precondition failed"
    }
}

Do not assume details is always present.

Deployment event stream

Deploy emits newline-delimited JSON because planning and applying have multiple stages:

bash
zynohosting deploy example.com ./dist --dry-run --json

Event types are:

TypeMeaning
progressA current planning or apply stage.
planExact operations, display groups, counts, ignores, and upload bytes.
dry_run_completePlanning completed without mutation.
resultApply result with create/replace/delete counts and duration.
cancelledInteractive apply was declined.

Consume one JSON object per line rather than parsing the complete standard output as a single document.

Exit codes

Exit codeCategory
0Success.
1Unexpected CLI or runtime failure.
2Invalid local input, unsafe path, configuration, or missing confirmation.
3Authentication or authorization failure, including expired login.
4Remote API failure or failed ETag/create-only precondition.
5Invalid, incompatible, or unsafe manager/agent response.
6Unknown or expired plan/session.
7The node agent could not apply a deployment.
8Mutation applied, but cache invalidation could not be queued.

Exit code 8

The remote mutation already succeeded. Do not blindly retry the deployment as though nothing changed; inspect the site and retry cache invalidation through an approved operational path.

Common error codes

CodeTypical resolution
missing_configRun zynohosting login or provide an API key.
login_expiredRun interactive login again.
invalid_environmentUse production, alpha, or dev.
confirmation_requiredUse a terminal, --dry-run, or reviewed --yes.
precondition_failedRefresh the file listing and review the new ETag/content.
plan_expiredCreate and review a new plan.
unsafe_local_pathChoose an absolute destination inside an allowed MCP root.
unsupported_protocolUpgrade the CLI or resolve cluster version skew.
cache_invalidation_failedTreat the mutation as applied and investigate cache invalidation.

Shell example

bash
set +e
zynohosting files put example.com ./index.html index.html --json >result.json
status=$?
set -e

if [ "${status}" -ne 0 ]; then
  echo "ZynoHosting operation failed with exit code ${status}" >&2
  exit "${status}"
fi

When file content is streamed with files get --output -, standard output contains bytes and cannot also contain JSON.

Documentation for the ZynoHosting CLI and local MCP server.