Loading image...Kiro

Product

  • About Kiro
  • Agents
  • IDE
  • CLI
  • Web
  • Mobile
  • Crew
  • Pricing
  • Downloads

For

  • Enterprise
  • Startups
  • Students

Community

  • Overview
  • Ambassadors
  • Case studies
  • Discord
  • Events
  • Powers
  • Shop
  • Showcase

Resources

  • Docs
  • Blog
  • Changelog
  • FAQs
  • Videos
  • Report a bug
  • Suggest an idea
  • Billing support

Social

Site TermsLicenseResponsible AI PolicyLegalPrivacy PolicyCookie Preferences
Kiro
  • Agents
  • Enterprise
  • Pricing
  • Docs
SIGN INDOWNLOADS
Kiro

Get Started

InstallationAuthenticationYour first project

Models

OverviewAvailable modelsReasoning effortAWS GovCloud (US) models

Features

How Kiro worksLocal command sandboxACP integrations
Specs
Steering
Hooks
MCP
Permissions
Custom agents
Workflows
Agent Skills
Powers
Cloud sessionsMemoryCompactionKiroignoreCheckpoints and rewind
Built-in tools
Configuration scopes

IDE 1.x

What's new in 1.0
Setup & First Run
Editor
Chat
Experimental
Troubleshooting0.x reference

CLI

What's new in V3
Setup & First Run
Terminal UI
Chat
Fullscreen modeVoice modeHeadless modeACPAuto complete
Experimental
2.x reference

Crew

Quick startInstallationRunning 24/7
Chat
Agent Capabilities
Features
Interfaces
Apps
System & storageConfigurationSecurityTroubleshooting

Web

Setup & First RunIdentity Center
Connect your repositories
Working with the agent
Autonomous modeScheduleConfiguration Sync
Sandbox

Mobile - Preview

Overview

Commands and Reference

CLI commandsSlash commandsBuilt-in toolsExit codesSettings

Billing

OverviewManaging your subscriptionUpgrading your planDowngrading your planCancelling your planPurchasing add-on creditsManaging your paymentsManaging usage notificationsManaging your taxesContacting billing supportDeleting your accountRelated questions

Enterprise

ConceptsOnboarding quickstart
Connecting your identity provider
Deployment optionsSubscribe your teamManage subscriptions
Governance
Monitor and track
SettingsManaged updatesTLS inspection compatibilityBillingIAMSupported regions
AWS GovCloud (US)

Privacy and Security

OverviewData protectionCode referencesCompliance validationInfrastructure securityIAM permissionsFirewalls, proxies, and data perimetersVPC endpoints (AWS PrivateLink)

Guides

OverviewRunning Kiro in the cloud
Language support
Learn by playing

Migration

Migrating from Q DeveloperMigrating from VSCodeUpgrading from Q CLI
  1. Docs
  2. Commands and Reference
  3. Exit codes
View as Markdown

Exit codes

View as Markdown

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 FailureA server required by --require-mcp-startup did not start
4Requested Agent Not FoundThe agent a non-interactive run named was unavailable on the selected agent engine

Requiring MCP servers

By default, MCP server failures are logged as warnings but don't affect the exit code. Use --require-mcp-startup to wait for configured MCP servers before a run begins:

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

If a required server does not start, Kiro CLI exits with code 3. In a non-interactive V3 run, this includes a server failure, an undetermined startup state, or no reported status within 30 seconds.

Info

Use --require-mcp-startup in CI/CD pipelines where MCP tools are essential. This prevents the task from starting without the expected tools.

Requested agent not found

A non-interactive run (--no-interactive, V2 or V3) exits with code 4 when its named agent isn't available on the selected agent engine:

  • A run names an agent with --agent on either engine. If that agent isn't found, the run exits 4.
  • On V3, a fresh session also names the chat.defaultAgent setting. If that configured default is unavailable, the run exits 4.
  • A run with no named agent is not gated. This includes resumed sessions without --agent.

On V3, a named agent that exists only in the V2 format also counts as unavailable. In Kiro CLI 2.37 or later, a stopped run says stopping (exit 4) and, for a V2-format agent, names the kiro-cli agent upgrade <directory> command for that agent's directory. Run it, then retry. See Upgrading agent configs.

Exit code 4 applies regardless of --trust-all-tools.

Warning

Kiro can detect the missing agent after the turn has started. In that case, the built-in default agent may already have done some work, including tool calls, before the run stops with exit code 4. Any output already written to stdout stays there.

Other --agent failures do not exit 4. They report the error and exit with code 1.

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 ;; 4) echo "Requested agent not found"; 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: November 2, 2026
Built-in tools
Settings