Exit codes
CLI exit codes for scripting and CI/CD integration
Mind 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
| Code | Name | Description |
|---|---|---|
| 0 | Success | Command completed successfully |
| 1 | Failure | General failure (auth error, invalid args, operation failed) |
| 3 | MCP Startup Failure | MCP 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:
mind chat --require-mcp-startup --no-interactive "Run task"
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
#!/bin/bash
mind 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 ;;
esacHook exit codes
Hooks use a separate set of exit codes to control tool execution:
| Code | Behaviour |
|---|---|
| 0 | Hook succeeded |
| 2 | (PreToolUse only) Block tool execution; STDERR returned to LLM |
| Other | Hook failed; STDERR shown as warning |
Best practices
- Use
--require-mcp-startupin CI/CD when your tasks depend on MCP tools - Add verbose logging (
-vor-vv) when debugging exit code issues - Check exit codes explicitly rather than relying on implicit shell behaviour
- Separate MCP failures from general failures to provide better error messages