8000 Troubleshooting · sysid/rs-env Wiki · GitHub
[go: up one dir, main page]

Skip to content

Troubleshooting

sysid edited this page Mar 6, 2026 · 5 revisions

Troubleshooting

Solutions to common rsenv issues.

Installation Issues

"command not found: rsenv"

rsenv isn't in your PATH:

# If installed via cargo, add to PATH
export PATH="$HOME/.cargo/bin:$PATH"

# Add to shell config for persistence
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Cargo install fails

# Update Rust
rustup update

# Clean and retry
cargo clean
cargo install rsenv

Vault Issues

"Vault not initialized"

Project doesn't have a vault:

# Initialize
rsenv init vault

# Or check if you're in the right directory
pwd
ls -la .envrc

Broken .envrc symlink

# Check symlink target
ls -la .envrc

# If vault exists but symlink is broken
rsenv init vault  # Will detect existing vault

# If vault was deleted
rsenv init vault  # Creates new vault

"Cannot find vault" after directory move

If you moved your project directory:

# Symlinks may be broken if relative
# Reinitialize with absolute paths
rsenv init reset
rsenv init vault --absolute

Wrong vault connected

# Check current vault
rsenv info

# Reset and reinitialize
rsenv init reset
rsenv init vault

Environment Issues

"File not found" for parent

Parent env file doesn't exist or path is wrong:

# Check the rsenv directive
cat problematic.env | grep "# rsenv:"

# Verify parent exists
ls -la $(dirname problematic.env)/

# Check path expansion
echo $RSENV_VAULT

Variables not inheriting

# Check hierarchy order
rsenv env files leaf.env

# View tree
rsenv env tree

# Build and inspect
rsenv env build leaf.env

Circular dependency error

Your environment files have a cycle:

# Check for cycles manually
# a.env: # rsenv: b.env
# b.env: # rsenv: a.env  <- cycle!

# Remove circular reference
vim offending.env

Environment not loading

direnv might need to be allowed:

# Allow direnv
direnv allow

# Check if .envrc is executable/readable
ls -la .envrc

# Force reload
direnv reload

Guarding Issues

"File already guarded"

File is already a symlink to vault:

# Check file status
ls -la path/to/file

# If you need to re-guard, restore first
rsenv guard restore path/to/file
rsenv guard add path/to/file

"File not within project"

Can only guard files inside the project directory:

# Check project root
rsenv info

# File must be under this directory
pwd
ls -la file-to-guard

Guarded file missing from vault

# Check vault location
ls -la $RSENV_VAULT/guarded/

# The path mirrors project structure
ls -la $RSENV_VAULT/guarded/config/secrets.yaml

Can't restore guarded file

# Check if file is actually a symlink
ls -la path/to/file

# Check vault file exists
ls -la $(readlink path/to/file)

# Manual restore if needed
cp $RSENV_VAULT/guarded/path/to/file ./path/to/file
rm path/to/file  # Remove symlink first
mv vault-file ./path/to/file

Swap Issues

New File created while parent directory swapped out

  • if a file accidentally has been created at a location which is currently swapped out, just init the file/directory. It will be added to the vault at the swapped-out parent directory.
rsenv swap init <file-path|dir-path>

"File already swapped on host X"

Another host has the file swapped in:

# Check status
rsenv swap status

# Swap out on the other host first, or manually remove the marker file
rm file.yml.otherhost.rsenv_active
rsenv swap in file.yml

Swap file not in vault

Initialize it first:

rsenv swap init path/to/file

Duplicate entries in swap status

If rsenv swap status shows duplicate entries (e.g., file and file with trailing space), this is caused by paths containing invisible whitespace characters (often non-breaking spaces from copy-paste).

Fixed in v5.1.0: rsenv now automatically sanitizes paths by stripping trailing whitespace.

To clean up existing duplicates:

# List vault swap directory to identify duplicates
ls -la $RSENV_VAULT/swap/ | cat -A  # Shows special chars as M-BM-

# Delete the spurious directories (with NBSP shown as \xc2\xa0)
rm -rf $RSENV_VAULT/swap/$'dirname\xc2\xa0'

SOPS Issues

"gpg: decryption failed: No secret key"

Your GPG key isn't available:

# List your keys
gpg --list-secret-keys

# Import if needed
gpg --import /path/to/key.asc

# Check configured key matches
rsenv config show | grep gpg_key

"SOPS could not find configuration"

No GPG key configured:

# Edit config
vim ~/.config/rsenv/rsenv.toml

# Add:
[sops]
gpg_key = "YOUR_FINGERPRINT"

"No files match patterns"

Check your encryption patterns:

# Show config
rsenv config show

# Check what would be encrypted
rsenv sops status

# List files manually
ls -la $RSENV_VAULT/*.env

Encrypted file won't decrypt

# Check key used to encrypt
sops --decrypt --verbose file.enc 2>&1 | grep key

# Verify you have that key
gpg --list-secret-keys | grep FINGERPRINT

direnv Issues

"direnv: error .envrc"

Syntax error in .envrc:

# Check .envrc content
cat .envrc

# Remember: it's a symlink
cat $RSENV_VAULT/dot.envrc

# Fix and reload
vim $RSENV_VAULT/dot.envrc
direnv allow

"direnv: error blocked"

# Allow the .envrc
direnv allow

# If still blocked, check direnv config
cat ~/.config/direnv/direnv.toml

Environment not updating

# Force reload
direnv reload

# Or leave and re-enter directory
cd .. && cd -

Configuration Issues

Config file not found

# Check paths
rsenv config path

# Create if missing
rsenv config init --global

Environment variable not applied

# Verify export
echo $RSENV_VAULT_BASE_DIR

# Must be exported, not just set
export RSENV_VAULT_BASE_DIR=~/my-vaults

TOML parse error

# Check syntax
cat ~/.config/rsenv/rsenv.toml

# Common issues:
# - Missing quotes around values with special chars
# - Incorrect array syntax (use ["a", "b"])
# - Tabs instead of spaces

General Debugging

Enable verbose output

rsenv --verbose <command>

Check versions

rsenv --version
sops --version
gpg --version
direnv --version

Reset everything

If all else fails:

# Backup vault first!
cp -r $RSENV_VAULT ~/vault-backup

# Reset project
rsenv init reset

# Delete vault
rm -rf $RSENV_VAULT

# Start fresh
rsenv init vault

Getting Help

Check Documentation

File an Issue

If you've found a bug:

  1. Check existing issues: https://github.com/sysid/rsenv/issues
  2. Include:
    • rsenv version (rsenv --version)
    • OS and version
    • Steps to reproduce
    • Expected vs actual behavior
    • Relevant config (redact secrets!)

Debug Information

Collect for bug reports:

rsenv --version
rsenv info
rsenv config show
rsenv config path
ls -la .envrc
echo $RSENV_VAULT

rsenv Documentation

Getting Started
Features
Reference
Upgrading

Clone this wiki locally

0