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
Configuration Reference
Error Formatting
format.verboseShow detailed stack traces and context in error messages.
Environment variable:
ATMOS_VERBOSEDefault:falseWhen
false(compact mode):- Clean, user-friendly error messages
- Actionable hints and suggestions
- Essential context only
When
true(verbose mode):- Full stack traces with file/line information
- Complete error chain showing how the error propagated
- Detailed context tables with all metadata
Sentry Integration
sentry.enabledEnable or disable Sentry error reporting.
Default:
falsesentry.dsnSentry DSN (Data Source Name) from your Sentry project settings. This is the endpoint where errors are sent.
Example:
https://examplePublicKey@o0.ingest.sentry.io/0sentry.environmentEnvironment name for error grouping in Sentry (e.g., "production", "staging", "ci").
Example:
productionsentry.releaseRelease version for tracking errors by deployment. Useful for identifying regressions.
Example:
1.0.0orcommit-abc123sentry.sample_ratePercentage of errors to send to Sentry. Use values between 0.0 and 1.0.
Default:
1.0(100% of errors sent) Example:0.5sends 50% of errorssentry.debugEnable debug mode for troubleshooting the Sentry integration. Outputs additional diagnostic information.
Default:
falsesentry.capture_stack_contextInclude surrounding code context in stack traces sent to Sentry.
Default:
truesentry.tagsCustom key-value tags for filtering and grouping errors in Sentry. These appear as searchable attributes in the Sentry UI.
Example:
tags:
team: "platform"
service: "atmos"
datacenter: "us-east-1"
Enabling Verbose Mode
You can enable verbose mode temporarily via environment variable:
# 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
Using Profiles for CI vs. Local Development (Recommended)
The recommended approach is to use Atmos profiles to separate CI/CD error monitoring from local development. This keeps your base configuration clean and avoids the need for environment variables on every command.
atmos.yaml
Then in your CI/CD pipeline, activate the profile:
# GitHub Actions example
- name: Deploy infrastructure
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
CI_ENVIRONMENT: production
CI_COMMIT_SHA: ${{ github.sha }}
CI_PIPELINE_ID: ${{ github.run_id }}
CI_COMMIT_BRANCH: ${{ github.ref_name }}
run: |
atmos terraform apply vpc -s prod/us-east-1 --profile ci
This approach provides:
- Local development: Verbose errors, no Sentry noise, fast iteration
- CI/CD pipelines: Clean logs, full Sentry monitoring, actionable alerts
- No environment variables needed locally: Just run
atmos terraform planwithout any setup
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 (Environment Variables)
If you prefer environment variables over profiles, you can 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