Back to index

Error Handling and Troubleshooting

This document covers common errors, environment variables, debugging tips, and OS-specific considerations for agent-sync.

Common Errors

Error Description Solution
configuration file not found The agent-sync.yml file could not be found Ensure you’re in the correct directory or specify the path with --config
invalid configuration format The configuration file has syntax errors Check the YAML syntax for errors
mixed configuration format Both simplified and standard formats were detected Use either the simplified format or the standard format, not both
agent not found The specified agent is not supported Check for typos or use agent-sync list agents to see supported agents
file access denied Permission issues when reading/writing files Check file permissions

Environment Variables

agent-sync recognizes the following environment variables:

Variable Description
AGENT_SYNC_LOG_FILE Log file path (overridden by --log-file flag)
AGENT_SYNC_LOG_LEVEL Log level (overridden by --log-level flag)

Debugging Tips

  1. Use --dry-run: Preview what would be generated without writing files
  2. Enable debug logging: Use --debug for a shorthand that sets level to debug and enables console output, or use --log-level=debug --verbose explicitly
  3. Check output path formatting: Remember that paths ending with / are treated as directories, while paths without are treated as files
  4. Check file permissions: Ensure you have read permissions for input files and write permissions for output directories
  5. Examine template processing: If you suspect issues with templates, try creating simpler templates first to isolate the problem
  6. Check for conflicting paths: Make sure you’re not writing to the same output file from different tasks

Using Enhanced Dry-Run Mode

The --dry-run flag provides a powerful way to preview and debug your configuration without making actual changes. The enhanced output format offers:

  1. Agent-based organization: Output is grouped by agent, making it easy to see how files will be processed for each target system

  2. Status indicators: Each file is prefixed with one of these status tags:
  3. File details: For each file, you’ll see:
  4. Agent summaries: For each agent, a summary is provided showing:

Example of using dry-run to debug configuration issues:

# Run in dry-run mode to check configuration
agent-sync apply --dry-run

# If you need more details, combine with debug logging
# Shorthand (debug level + console output)
agent-sync apply --dry-run --debug
# Equivalent explicit form
agent-sync apply --dry-run --log-level debug --verbose

This helps identify issues such as:

OS-Specific Considerations

Path Handling

Default Output Paths

Some default paths differ between operating systems:

Note:

Troubleshooting Log Issues

If you’re having issues with logs:

  1. Log file not being created:
  2. Missing detailed information:
  3. Too much log information:

For more information about logging configuration, see the Logging Guide.


Previous Next
Examples and Best Practices  

Back to index