Loading image...Kiro
  • CLI
  • Powers
  • Autonomous agent
  • Enterprise
  • Pricing
  • Docs
SIGN INDOWNLOADS
Loading image...Kiro
Loading image...Kiro
Product
  • About Kiro
  • CLI
  • Powers
  • Autonomous agent
  • Pricing
  • Downloads
For
  • Enterprise
  • Startups
Resources
  • Documentation
  • Blog
  • Changelog
  • FAQs
  • Report a bug
  • Suggest an idea
  • Billing support
Social
Site TermsLicenseResponsible AI PolicyLegalPrivacy PolicyCookie Preferences
  1. Docs
  2. CLI
  3. Reference
  4. Exit Codes

Exit codes

On this page
  • Exit code reference
  • Requiring MCP servers
  • Scripting examples
  • Bash script
  • CI/CD pipeline
  • Hook exit codes
  • Best practices

Kiro CLI returns specific exit codes to indicate operation status. Use these in scripts and CI/CD pipelines to detect success, failures, and specific error conditions.

Exit code reference

CodeNameDescription
0SuccessCommand completed successfully
1FailureGeneral failure (auth error, invalid args, operation failed)
3MCP Startup FailureMCP server failed to start (requires --require-mcp-startup)

Requiring MCP servers

By default, MCP server failures are logged as warnings but don't affect the exit code. Use --require-mcp-startup to fail fast when MCP servers are critical to your workflow:

bash
kiro-cli chat --require-mcp-startup --no-interactive "Run task"

If any configured MCP server fails to start, the CLI exits immediately with code 3.

Info

Use --require-mcp-startup in CI/CD pipelines where MCP tools are essential. This prevents silent failures where tasks complete without the expected tooling.

Scripting examples

Handle different exit codes to take appropriate action in your automation:

Bash script

bash
#!/bin/bash kiro-cli chat --require-mcp-startup --no-interactive --trust-all-tools "Run analysis" exit_code=$? case $exit_code in 0) echo "Success" ;; 3) echo "MCP servers failed to start"; exit 1 ;; *) echo "Failed with code $exit_code"; exit $exit_code ;; esac

CI/CD pipeline

yaml
- name: Run Kiro task run: | kiro-cli chat --require-mcp-startup --no-interactive --trust-all-tools "Analyze code" continue-on-error: false

Hook exit codes

Hooks use a separate set of exit codes to control tool execution:

CodeBehavior
0Hook succeeded
2(PreToolUse only) Block tool execution; STDERR returned to LLM
OtherHook failed; STDERR shown as warning

Best practices

  • Use --require-mcp-startup in CI/CD when your tasks depend on MCP tools
  • Add verbose logging (-v or -vv) when debugging exit code issues
  • Check exit codes explicitly rather than relying on implicit shell behavior
  • Separate MCP failures from general failures to provide better error messages to users
Page updated: February 5, 2026
Built-in tools
Settings