CLI

Troubleshooting

Symptom → cause → fix for the Shelve CLI and agent automation.

Quick fixes for the most common CLI issues. Run shelve doctor (or shelve --json doctor) first — it checks config, auth, API, cache, and agent context in one shot.

terminal
shelve doctor
shelve --json doctor

Error codes

CodeMeaningFix
AGENT_BLOCKEDpull in an AI agent shell without --yesUse shelve run -- <cmd> or pass --yes if disk .env is required
AUTH_REQUIREDNo tokenexport SHELVE_TOKEN=… or shelve login
CONFIG_MISSINGNo shelve.json and missing envCreate config or set SHELVE_TEAM_SLUG + SHELVE_PROJECT
MISSING_ENVNo environment selected--env staging or defaultEnv in config
MISSING_INPUTNon-interactive mode missing a flagPass the flag shown in the error hint
FETCH_FAILEDNetwork/API failure, no cacheGo online once, or use --offline if cache exists
FORBIDDENToken lacks scopeCreate a token with read/write for the team/project
PROJECT_NOT_FOUNDProject missingEnable autoCreateProject or shelve create
PUSH_BLOCKEDPush disabled for this envCheck sync.protectedEnvironments or allowPush
PULL_BLOCKEDPull disabled for this envSet sync.environments.<env>.allowPull
SYNC_CONFLICTDiverging keys and onPushConflict: failRun shelve diff, align values, or change policy
ENV_PROTECTEDServer blocked write to protected envUpdate project sync policy in Shelve settings

See also shelve --help for the full list of structured error codes.

Exit codes

CodeMeaning
0Success
1CLI or API error
128 + nChild killed by signal (run)
129Parent process gone / stdin EIO
130 / 143SIGINT / SIGTERM (often treated as clean shutdown in run)

Common symptoms

CLI hangs waiting for input

Cause: Interactive prompt (login, missing --env, confirmation).

Fix:

terminal
export SHELVE_TOKEN=export SHELVE_TEAM_SLUG=export SHELVE_PROJECT=shelve --non-interactive doctor

shelve run dev exits instantly

Cause: Script resolution failed or script exits immediately.

Fix:

terminal
shelve run --debug dev
shelve run -- pnpm dev

Secrets not updated after Shelve UI change

Cause: Old process env or stale cache.

Fix: Restart with shelve run, or use --watch --restart-on-change.

pull fails in Cursor / Claude Code

Cause: Agent guard (AGENT_BLOCKED).

Fix: Prefer shelve run -- <cmd>. Only shelve pull --yes if you explicitly need a .env file.

Offline / plane mode

Fix:

terminal
# After one successful online run:
shelve run --offline -- pnpm build

JSON automation parse errors

  • Success → stdout: { "ok": true, "data": … }
  • Errors → stderr: { "ok": false, "error": { "code", "message" } }
  • run spawn metadata → stderr event: { "ok": true, "event": "child_spawned", … }

Secret values are never included in JSON output.

CI / GitHub Actions

Use the composite action:

- uses: ./.github/actions/shelve-run
  with:
    token: ${{ secrets.SHELVE_TOKEN }}
    team-slug: my-team
    project: my-app
    env: ci
    command: pnpm test

Validate secrets before the main job:

- run: npx @shelve/cli --json doctor
  env:
    SHELVE_TOKEN: ${{ secrets.SHELVE_TOKEN }}
    SHELVE_TEAM_SLUG: my-team
    SHELVE_PROJECT: my-app

Agent skill

Install the published skills:

terminal
npx skills add https://shelve.cloud

Catalog: https://shelve.cloud/.well-known/skills/index.json (skill: shelve).