Troubleshooting
A guide to diagnosing and resolving common Anvil issues.
1. Installation Issues
Anvil won't run
Symptoms:
- "anvil" is not recognized as a command
- Application crashes immediately
Solutions:
-
Check PATH configuration
Windows:
where.exe anvil # If not found, add to PATH $env:PATH += ";C:\path\to\anvil"Linux/macOS:
which anvil # If not found, add to PATH export PATH="$PATH:/path/to/anvil" -
Verify platform compatibility
- Anvil currently requires Windows 10 (1809+) or Windows 11
- Cross-platform support is on the roadmap
-
Verify the download isn't corrupted
- Re-download from the releases page
- Verify the file hash if provided
Package manager not found
Symptoms:
- Error: "winget is not recognized"
- Error: "Package manager not available"
- Package installation fails before starting
Solutions (Windows — winget):
-
Install Windows Package Manager
# Open Microsoft Store to App Installer Start-Process "ms-windows-store://pdp/?ProductId=9NBLGGH4NNS1" -
Update App Installer
- Open Microsoft Store → search "App Installer" → click "Update"
-
Test availability
winget --version -
Restart your terminal after installing winget
2. Package Installation Issues
Package not found
Symptoms:
- Error: "No package found matching input criteria"
- Error: "Package 'X' not found in any source"
Solutions:
-
Verify package ID
winget search <package-name> winget search --exact "Package Name" -
Check package source in workload
packages: winget: - id: SomeApp.App source: msstore # For Microsoft Store apps -
Update package sources
winget source update
Installation hangs
Symptoms:
- Installation appears frozen
- No progress for extended time
Solutions:
-
Check for interactive prompts
- Some installers require user interaction
- Run anvil without
--quietto see prompts
-
Use silent install overrides
packages: winget: - id: SomeApp.App override: - "--silent" - "--accept-license" -
Check for pending system updates
- Pending OS updates can block installations
- Complete any pending updates and restart
Access denied during installation
Symptoms:
- Error: "Access is denied"
- Error: "Administrator privileges required"
Solutions:
-
Run with elevation (Windows)
Start-Process powershell -Verb RunAs anvil install my-workload -
Use user-scope installation
packages: winget: - id: Package.Name override: - "--scope" - "user"
3. File Operation Issues
Permission denied
Symptoms:
- Error: "Permission denied" when copying files
- File operations fail
Solutions:
-
Use user-writable paths
files: - source: config.json destination: "~/.config/app/config.json" # Expands to user home -
Check target directory permissions
Windows:
Get-Acl "C:\path\to\directory" | Format-ListLinux/macOS:
ls -la /path/to/directory -
Run as administrator for system-level paths
File not found
Symptoms:
- Error: "Source file not found"
Solutions:
-
Verify source path — paths are relative to the workload directory
files: - source: files/config.json # Relative to workload dir destination: "~/.config/app/config.json" -
Check workload directory structure
my-workload/ ├── workload.yaml └── files/ └── config.json
Backup failed
Symptoms:
- Error: "Failed to create backup"
Solutions:
- Check disk space
- Verify backup directory exists and is writable
$env:ANVIL_BACKUP_DIR = "D:\Backups\anvil"
4. Script Execution Issues
Script won't execute
Symptoms:
- Error: "Script execution failed"
- No output from script
Solutions:
-
Verify script path in workload.yaml — paths are relative to
scripts/scripts: post_install: - path: setup.ps1 # Relative to scripts/ directory -
Test script manually
& "C:\workloads\my-workload\scripts\setup.ps1"
Execution policy error (Windows)
Symptoms:
- Error: "Running scripts is disabled on this system"
Solutions:
-
Set execution policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -
Check group policy — corporate environments may have stricter policies
Script timeout
Symptoms:
- Error: "Script execution timed out"
Solutions:
-
Increase timeout in workload
scripts: post_install: - path: scripts/long-running.ps1 timeout: 1800 # 30 minutes (default: 300) -
Check for infinite loops or slow network operations in the script
Elevated script fails (Windows)
Symptoms:
- Error: "Elevation required"
Solutions:
- Run anvil as administrator
- Set the elevated flag in workload.yaml
scripts: post_install: - path: scripts/admin-setup.ps1 elevated: true
5. Health Check Issues
False failures
Symptoms:
- Health check fails but software is working
- Intermittent failures
Solutions:
-
Run with verbose output
anvil health my-workload --verbose -
Review health check scripts — they may have outdated expectations
-
Update version expectations
winget list --id Package.Name
Partial results
Symptoms:
- Some checks don't run
- Health report incomplete
Solutions:
-
Check verbose output for errors in earlier checks
anvil health my-workload -vvv -
Verify all referenced scripts exist in the workload directory
6. Configuration Issues
Config file not loading
Symptoms:
- Settings not applied
- Default values used instead of custom
Solutions:
-
Check config location
anvil config path -
View current configuration
anvil config list -
Reset to defaults
anvil config reset
Workloads not found
Symptoms:
- Error: "Workload 'X' not found"
- Empty list from
anvil list
Solutions:
-
Check search paths
anvil config list -
Verify workload structure — needs a
workload.yamlfileworkload-name/ └── workload.yaml -
Use explicit path
anvil install my-workload --path /path/to/workloads
7. Error Reference
Common Error Codes
| Error | Description | Solution |
|---|---|---|
E001 | Workload not found | Check name and search paths |
E002 | Invalid workload schema | Run anvil validate for details |
E003 | Circular dependency | Review extends chain in workloads |
E004 | Package installation failed | Check package manager logs, verify package ID |
E005 | File operation failed | Check permissions, verify paths |
E006 | Script execution failed | Review script output, check syntax |
E007 | Health check failed | Review check results, update scripts |
E008 | Configuration error | Validate config file syntax |
E009 | Backup operation failed | Check disk space and permissions |
E010 | Restore operation failed | Verify backup exists and is valid |
8. Getting Help
Verbose Output
Get more detailed information about what Anvil is doing:
anvil -v <command> # Some detail
anvil -vv <command> # More detail
anvil -vvv <command> # Maximum detail (debug level)
Enable Logging
# Set log level via environment variable
ANVIL_LOG=debug anvil install my-workload
# Available levels: error, warn, info, debug, trace
System Information
Gather helpful information when reporting issues:
# Anvil version
anvil --version
# Operating system
# Windows: winver
# Linux/macOS: uname -a
# Package manager version
winget --version # Windows
Reporting Issues
When reporting issues, include:
- Anvil version:
anvil --version - Operating system and version
- Command that failed: exact command you ran
- Error message: complete error output
- Verbose output: run with
-vvvflag - Workload file: contents of
workload.yaml(sanitized if needed)
Resources
Quick Reference
Common Commands for Troubleshooting
# Check Anvil installation
anvil --version
# Validate workload
anvil validate my-workload --strict
# Preview installation (dry run)
anvil install my-workload --dry-run
# Verbose health check
anvil health my-workload -vvv
# View current configuration
anvil config list
# Reset configuration
anvil config reset
Environment Variables
| Variable | Purpose |
|---|---|
ANVIL_CONFIG | Custom config file path |
ANVIL_WORKLOADS | Additional workload search paths |
ANVIL_LOG | Log level (error, warn, info, debug, trace) |
ANVIL_BACKUP_DIR | Custom backup directory |
NO_COLOR | Disable colored output |