Error Handling & Monitoring
Configure how Atmos formats and reports errors, including Sentry integration for monitoring command failures across your organization.
Why Monitor Atmos Errors?β
When running Atmos across an organizationβespecially in CI/CD pipelinesβstaying on top of failures can be a significant challenge. Atmos provides built-in error monitoring capabilities to help you:
- Track infrastructure deployment failures across multiple teams and environments
- Identify patterns in configuration errors before they affect production
- Debug CI/CD pipeline issues with detailed stack traces and context
- Monitor the health of your infrastructure automation at scale
- Receive alerts when critical Atmos operations fail
Configurationβ
The errors section in atmos.yaml controls error formatting and Sentry integration:
atmos.yaml
Error Formattingβ
Verbose Modeβ
Control the level of detail in error messages with the errors.format.verbose setting:
Compact Mode (verbose: false - default):
- Clean, user-friendly error messages
- Actionable hints and suggestions
- Essential context only
- Perfect for end-users and CI logs
Verbose Mode (verbose: true):
- Full stack traces with file/line information
- Complete error chain showing how the error propagated
- Detailed context tables with all metadata
- Useful for debugging complex issues
You can also enable verbose mode temporarily:
# Enable verbose errors for a single command
ATMOS_VERBOSE=true atmos terraform plan
# Or set it globally in your shell
export ATMOS_VERBOSE=true
Error Message Structureβ
Atmos formats errors as structured markdown with the following sections:
- Error - Clear description of what went wrong
- Explanation - Detailed context about why it failed
- Example - Code snippets showing the correct approach
- Hints - Actionable suggestions to fix the problem
- Context - Key-value pairs (component, stack, region, etc.)
- Stack Trace - Full error chain (verbose mode only)
Example error output:
# Error
component 'vpc' not found in stack 'prod/us-east-1'
## Hints
π‘ Use 'atmos list components --stack prod/us-east-1' to see available components
π‘ Check if the component is defined in your stack manifests
π‘ Verify the stack name is correct: prod/us-east-1
## Context
| Key | Value |
|-----------|-----------------|
| component | vpc |
| stack | prod/us-east-1 |
Sentry Integrationβ
What Gets Sent to Sentry?β
Atmos only sends command failures to Sentryβerrors that prevent a command from completing successfully and cause Atmos to exit with a non-zero exit code.
Errors sent to Sentry:
- β Command failures (invalid arguments, missing configuration)
- β Component not found errors that block deployments
- β Stack validation errors preventing infrastructure changes
- β Workflow execution failures
- β Authentication/authorization errors
- β
File system errors (missing
atmos.yaml, unreadable stack files)
Errors NOT sent to Sentry:
- β Debug/trace log messages
- β Warnings (e.g., deprecated configuration options)
- β Non-fatal errors that Atmos recovers from
- β Successful commands (exit code 0)
Information included with each error:
- Error message and type - What went wrong
- Hints β Sentry breadcrumbs to help debug the issue
- Context β Tags like component name, stack name, region (PII-safe)
- Exit code β Command exit code for automation
- Stack traces β Full error chain with file/line information for debugging
- Environment β From
errors.sentry.environmentconfig - Custom tags β From
errors.sentry.tagsconfig
This ensures Sentry focuses on actionable failures that affect users, without overwhelming it with internal logging or successful operations.
Setting Up Sentryβ
-
Create a Sentry project at sentry.io
-
Get your DSN from Project Settings β Client Keys (DSN)
-
Configure Atmos with your Sentry DSN:
atmos.yaml
- Test the integration by triggering an error:
# This will fail and send an error to Sentry
atmos terraform plan invalid-component -s nonexistent-stack
- Verify in Sentry that the error appears in your project's Issues dashboard
Environment-Specific Configurationβ
Configure different Sentry settings per environment:
atmos.yaml
Then in your CI/CD pipeline:
# GitHub Actions example
- name: Deploy infrastructure
env:
ATMOS_ENVIRONMENT: production
CI_COMMIT_TAG: ${{ github.ref_name }}
run: |
atmos terraform apply vpc -s prod/us-east-1
Privacy & Securityβ
PII-Safe Context:
Atmos uses structured context (via .WithContext()) that is designed to be PII-safe:
- β Component names, stack names, regions
- β File paths (relative, not absolute)
- β Exit codes
- β Error types
What is NOT sent:
- β Environment variable values (unless explicitly added)
- β Secrets or credentials
- β User input data
- β File contents
Sensitive DSN Handling:
Store your Sentry DSN securely:
# Don't commit DSN to version control
# Use environment variables instead
export ATMOS_SENTRY_DSN="https://your-public-key@sentry.io/project-id"
atmos.yaml
Use Casesβ
Monitoring CI/CD Pipelinesβ
Track infrastructure deployment failures across all your CI pipelines:
atmos.yaml
This allows you to:
- Filter errors by pipeline, branch, or team in Sentry
- Track error rates over time
- Set up alerts for critical failures
- Identify patterns (e.g., "VPC component fails in prod but not staging")
Multi-Team Organizationsβ
Different teams can share the same Sentry project with custom tags:
atmos.yaml
Then set team-specific environment variables:
export TEAM_NAME="platform"
atmos terraform apply vpc -s prod/us-east-1
Development vs. Productionβ
Reduce noise in development while maintaining full monitoring in production:
atmos.yaml
# Development (local machine)
export DEVELOPMENT=true
export SENTRY_ENABLED=false
# Production (CI/CD)
export SENTRY_ENABLED=true
export SENTRY_SAMPLE_RATE=1.0
export ENVIRONMENT=production
Troubleshootingβ
Errors Not Appearing in Sentryβ
-
Check DSN is correct:
# Test DSN connectivity
curl -X POST "${SENTRY_DSN}" -H "Content-Type: application/json" -d '{}' -
Enable debug mode:
atmos.yaml
-
Verify Sentry is enabled:
# Check if SENTRY_ENABLED is set
echo $SENTRY_ENABLED
# Trigger a test error
atmos terraform plan nonexistent -s invalid -
Check sample rate: If
sample_rate < 1.0, some errors may be dropped
Too Many Errors in Sentryβ
-
Adjust sample rate for noisy environments:
errors:
sentry:
sample_rate: 0.1 # Only 10% of errors -
Filter by environment: Use
environmenttags to separate CI from production -
Use Sentry's ignore rules: Configure in Sentry UI to filter out known issues
Related Documentationβ
- Terminal Configuration - Control color output and terminal behavior
- Common Errors - Solutions to common Atmos errors
- CLI Configuration - Complete
atmos.yamlreference
See Alsoβ
- Sentry Documentation - Official Sentry docs
- Configure Validation - Stack validation to catch errors early