Permission Errors
Backup Directory Permission Denied
Symptom: Error creating or accessing the.env-twin/ directory
Cannot Write to .env Files
Symptom: Permission denied when syncing or restoring filesPermission Denied on Windows
Symptom: Permission errors on Windows systems Solutions:- Run as Administrator: Right-click Command Prompt or PowerShell and select “Run as Administrator”
- Check file attributes: Remove read-only attribute:
- Antivirus interference: Temporarily disable antivirus and try again
- File in use: Close any editors or processes using
.envfiles
File Not Found Errors
Source File Not Found
Symptom: Cannot find the specified source fileCheck current directory
Check current directory
Make sure you’re in the correct project directory:
Verify file name
Verify file name
Check for typos or extra characters:
Specify custom source
Specify custom source
If your source file has a different name:
No .env Files Found
Symptom: env-twin cannot find any.env* files
-
Create initial .env file:
-
Check if files are hidden: On Unix systems, files starting with
.are hidden: -
Wrong directory: Navigate to your project root:
Backup Not Found
Symptom: Cannot find specified backup timestampCheck timestamp format
Ensure format is
YYYYMMDD-HHMMSS:- ✅ Correct:
20260304-143022 - ❌ Incorrect:
2026-03-04-14:30:22 - ❌ Incorrect:
20260304143022(missing dash)
Backup Restoration Failures
Backup Validation Failed
Symptom: Backup fails integrity checksCorrupted backup files
Corrupted backup files
The backup may be corrupted. Try restoring from an older backup:
File system permissions
File system permissions
Check if backup files are readable:
Incomplete backup
Incomplete backup
If a backup was interrupted during creation, some files may be missing:
-
Delete the incomplete backup:
-
Create a fresh backup:
Restoration Partially Failed
Symptom: Some files restored successfully, others failed-
Check specific file permissions:
-
Manually restore failed files:
-
Use force flag to override checks:
Rollback Failed
Symptom: Restore operation failed and rollback also failedMerge Conflicts and Sync Issues
Conflicting Values
Symptom: Same key has different values across files This is expected behavior. env-twin preserves existing values and only syncs keys (variable names), not values.env-twin synchronizes which environment variables exist across files, but does NOT overwrite existing values. This allows each environment file to maintain its own configuration.
Orphaned Keys
Symptom: Keys exist in some files but not in source of truthAdd to source of truth
Add to source of truth
If these keys should be standard, add them to your source of truth file:
Keep as local overrides
Keep as local overrides
Some keys are meant to be local-only (like
DEBUG_MODE). This is fine! env-twin will warn you but won’t force removal.Remove orphaned keys
Remove orphaned keys
If these keys are truly outdated:
- Manually edit the file to remove them
- Run sync to ensure consistency
Missing Keys Not Added
Symptom: Expected keys aren’t being added during sync Possible causes:-
Wrong source of truth: Check which file is being used as source:
-
Keys missing from source: Verify the source file contains the keys:
- File not detected: Ensure file matches detection patterns (see Configuration)
- Skipped during interactive prompts: You may have selected “Skip” when prompted to add keys
Command-Specific Issues
Default Command Issues
Symptom: Default command (copy .env to .env.example) not workingSync Command Issues
Symptom: Sync command hangs or prompts unexpectedly Solutions:-
Use —yes to skip prompts:
-
Check for interactive shell issues:
- If running in CI/CD, ensure stdin is not attached
- Use
--yesflag in automated environments
-
Review JSON output to understand what sync would do:
Clean Backups Issues
Symptom: Cannot delete old backupsPlatform-Specific Issues
Windows Path Issues
Symptom: Path errors on Windows Solutions:-
Use forward slashes or escape backslashes:
- Avoid UNC paths (\server\share)
-
Use Windows-compatible permissions:
macOS Permission Issues
Symptom: Permission denied despite correct permissions Solutions:- Check macOS security settings (System Preferences > Security & Privacy)
- Grant terminal full disk access if needed
- Use
sudoonly as last resort:
Linux Permission Issues
Symptom: Permission errors on Linux systems Solutions:Debugging Tips
Enable Verbose Logging
For restore operations, use--verbose to see detailed logs:
Use Dry Run
Test operations without making changes:Check File Contents
Manually inspect files when troubleshooting:Check System Resources
Getting Help
If you’ve tried the solutions above and still have issues:Check documentation
Review the full documentation at env-twin docs
Gather debug information
Collect the following information:
- env-twin version:
env-twin --version - Operating system and version
- Node.js version:
node --version - Full error message
- Steps to reproduce
- Verbose logs if available
Related Pages
- Backup Management - Understanding backups
- Configuration - Configuration options
- Best Practices - Avoid common pitfalls