Skip to content

Unable to edit-encrypted a .chezmoitemplate file #4816

@garrettreid

Description

@garrettreid

Describe the bug

Chezmoi edit-encrypted isn't handling a file inside .chezmoitemplate, instead failing to open the decrypted file for editing.

To reproduce

pwd
/Users/user/.local/share/chezmoils .chezmoitemplates/dot_ssh/personal_config.age
.chezmoitemplates/dot_ssh/personal_config.agechezmoi edit-encrypted .chezmoitemplates/dot_ssh/personal_config.age
age: error: open /var/folders/dm/jkdm56dx36n7gw42gn7ndgd80000gn/T/chezmoi-edit-encrypted142651989/.local/share/chezmoi/.chezmoitemplates/dot_ssh/personal_config.age: no such file or directory
age: report unexpected or unhelpful errors at https://filippo.io/age/report
chezmoi: exit status 1ls /var/folders/dm/jkdm56dx36n7gw42gn7ndgd80000gn/T/chezmoi*
zsh: no matches found: /var/folders/dm/jkdm56dx36n7gw42gn7ndgd80000gn/T/chezmoi*

Expected behavior

A clear and concise description of what you expected to happen.

Output of command with the --verbose flag

chezmoi --verbose edit-encrypted .chezmoitemplates/dot_ssh/personal_config.age
age: error: open /var/folders/xz/zlnmmdgj54l1_l9kcf4vrkhw0000gn/T/chezmoi-edit-encrypted873963688/.local/share/chezmoi/.chezmoitemplates/dot_ssh/personal_config.age: no such file or directory
age: report unexpected or unhelpful errors at https://filippo.io/age/report
chezmoi: exit status 1

Output of chezmoi doctor

chezmoi doctor
RESULT    CHECK                       MESSAGE
ok        version                     v2.68.0, commit 6603022e7719822c1ef84210216064d3196f0161, built at 2025-12-03T21:04:19Z, built by Homebrew
ok        latest-version              v2.68.0
ok        os-arch                     darwin/arm64
ok        uname                       Darwin MacBook 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:03 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8112 arm64
ok        go-version                  go1.25.5 (gc)
ok        executable                  /opt/homebrew/bin/chezmoi
ok        upgrade-method              brew-upgrade
ok        config-file                 found ~/.config/chezmoi/chezmoi.toml, last modified 2025-11-03T22:09:00-08:00
warning   source-dir                  ~/.local/share/chezmoi is a git working tree (dirty)
ok        suspicious-entries          no suspicious entries
warning   working-tree                ~/.local/share/chezmoi is a git working tree (dirty)
ok        dest-dir                    ~ is a directory
ok        hardlink                    created hardlink from ~/.local/share/chezmoi to /var/folders/dm/jkdm56dx36n7gw42gn7ndgd80000gn/T/
ok        symlink                     created symlink from .new-name to .old-name
ok        umask                       022
ok        cd-command                  found /bin/zsh
ok        cd-args                     /bin/zsh
info      diff-command                not set
ok        edit-command                found /opt/homebrew/bin/nvim
ok        edit-args                   /opt/homebrew/bin/nvim
ok        git-command                 found /usr/bin/git, version 2.50.1
ok        merge-command               found /usr/bin/vimdiff
ok        shell-command               found /bin/zsh
ok        shell-args                  /bin/zsh
ok        age-command                 found /opt/homebrew/bin/age, version 1.2.1
ok        gpg-command                 found /opt/homebrew/bin/gpg, version 2.4.8
info      pinentry-command            not set
info      1password-command           op not found in $PATH
info      bitwarden-command           bw not found in $PATH
info      bitwarden-secrets-command   bws not found in $PATH
info      dashlane-command            dcli not found in $PATH
info      doppler-command             doppler not found in $PATH
info      gopass-command              gopass not found in $PATH
info      keepassxc-command           keepassxc-cli not found in $PATH
info      keepassxc-db                not set
info      keeper-command              keeper not found in $PATH
info      lastpass-command            lpass not found in $PATH
info      pass-command                pass not found in $PATH
info      passhole-command            ph not found in $PATH
info      rbw-command                 rbw not found in $PATH
info      vault-command               vault not found in $PATH
info      secret-command              not set

Additional context

As the issue is with temp files, I looked at the mentioned hardlink in the chezmoi doctor output. It's the same temp directory used by all processes (e.g. contains "itunescloudd", "mobiletimerd", "com.apple.weatherd", etc). There isn't a link from .local/share/chezmoi that I can see, either.

This is related to #4676, but it seemed like I should open a new bug rather than commenting on a closed feature request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions