Error codes

WRONG_ENVIRONMENT

This command does not run in the current environment.

Exit code: 2 · Who acts: You: correct the request or the environment · From: the CLI, the SDK and the backend

What it means

This command does not run in the current environment.

Common causes

  • A dev command runs only on a local devnet.
  • A test command, such as test money, does not run in production.

Fix it

  1. Check where you are with capxul whoami.
  2. Change it with capxul use env devnet, or --env.

In JSON and the SDK

With --json, the CLI prints:

{
  "outcome": "refused",
  "error": {
    "code": "WRONG_ENVIRONMENT",
    "message": "…"
  }
}

In the SDK, a failed result has result.error.code === "WRONG_ENVIRONMENT". Branch on the code, not on the message: the message is written for people and can change.

Commands that can answer with it

On this page