Skip to main content

Exit codes

landbase-cli exits with a standard code on every invocation. Scripts and CI pipelines can branch on these codes to handle errors appropriately.

Code table

CodeNameWhen it is returned
0SuccessThe command completed successfully.
1User errorThe command cannot proceed due to invalid input: an unknown flag, a missing required argument, or a failed confirmation (e.g. datasets delete without --yes). Fix the command and re-run.
2API errorThe Landbase API returned an error, a resource was not found, a publish was required but not run, or a download failed. Check the error JSON on stderr for the error.code field.
3Auth errorNo valid authentication was available (no key, no session), or the key or session was rejected by the API. Run landbase-cli auth login to re-authenticate.
4Network or timeout errorThe request failed due to a connectivity issue or exceeded the configured timeout. Check your network and retry, or increase --timeout.

Reading the error JSON

When the exit code is non-zero, landbase-cli writes a structured error to stderr:
{
  "error": {
    "code": "AUTH_FAILED",
    "message": "No valid API key or session found. Run: landbase-cli auth login",
    "meta": {}
  }
}
The code field is a stable machine-readable string. See error codes reference for the full list.

Using exit codes in scripts

landbase-cli "find B2B SaaS in NYC" --download=results.jsonl
EXIT=$?

if [ $EXIT -eq 0 ]; then
  echo "Success"
elif [ $EXIT -eq 3 ]; then
  echo "Authentication failed — re-authenticating"
  landbase-cli auth login
elif [ $EXIT -eq 4 ]; then
  echo "Network error — retrying in 10 seconds"
  sleep 10
  landbase-cli "find B2B SaaS in NYC" --download=results.jsonl
else
  echo "Error (code $EXIT) — check stderr"
fi