{"record":{"id":"9ebe732fceae6af5","repo":"twpayne/chezmoi","slug":"encryption-not-configured","errorCode":null,"errorMessage":"encryption not configured","messagePattern":"encryption not configured","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/chezmoi/noencryption.go","lineNumber":5,"sourceCode":"package chezmoi\n\nimport \"errors\"\n\nvar errEncryptionNotConfigured = errors.New(\"encryption not configured\")\n\n// NoEncryption returns an error when any method is called.\ntype NoEncryption struct{}\n\n// Decrypt implements Encryption.Decrypt.\nfunc (NoEncryption) Decrypt([]byte) ([]byte, error) { return nil, errEncryptionNotConfigured }\n\n// DecryptToFile implements Encryption.DecryptToFile.\nfunc (NoEncryption) DecryptToFile(AbsPath, []byte) error { return errEncryptionNotConfigured }\n\n// Encrypt implements Encryption.Encrypt.\nfunc (NoEncryption) Encrypt([]byte) ([]byte, error) { return nil, errEncryptionNotConfigured }\n\n// EncryptFile implements Encryption.EncryptFile.\nfunc (NoEncryption) EncryptFile(AbsPath) ([]byte, error) { return nil, errEncryptionNotConfigured }\n\n// EncryptedSuffix implements Encryption.EncryptedSuffix.\nfunc (NoEncryption) EncryptedSuffix() string { return \"\" }","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/twpayne/chezmoi/blob/f901167e4685db90da56d6a2a19df642cb3e0247/internal/chezmoi/noencryption.go#L1-L23","documentation":"errEncryptionNotConfigured (internal/chezmoi/noencryption.go:5) is returned by every method of the NoEncryption placeholder type. It signals that an encryption operation (Decrypt, Encrypt, DecryptToFile, etc.) was attempted but no encryption backend (gpg, age) is configured.","triggerScenarios":"Chezmoi is constructed with NoEncryption and code calls Decrypt/Encrypt/DecryptToFile, e.g. processing encrypted_ prefixed source files without an encryption config.","commonSituations":"Encrypted files exist in the source state but no encryption = gpg/age block or keys are set in the config; running chezmoi in an environment missing GPG/age tooling; forgetting to run chezmoi init with encryption setup.","solutions":["Add an encryption section to your chezmoi config (e.g. [gpg] or [age] with recipient/symmetric settings).","Ensure the underlying tool (gpg or age) is installed and keys exist.","Remove or decrypt the encrypted_ files if encryption is not actually intended."],"exampleFix":"// ~/.config/chezmoi/chezmoi.toml\n// before: (no encryption block)\n// after:\n[encryption]\ncommand = \"age\"\n[age]\nidentity = \"~/.config/age/key.txt\"\nrecipient = \"age1...\"","handlingStrategy":"validation","validationCode":"cfg, err := chezmoi.LoadConfig()\nif err != nil || cfg.Encryption == nil || cfg.Encryption.Command == \"\" {\n    // configure encryption before processing encrypted_ files\n}","typeGuard":null,"tryCatchPattern":"if err := apply(); err != nil {\n    if errors.Is(err, errEncryptionNotConfigured) {\n        // prompt user to configure gpg/age in chezmoi.toml\n    }\n    return err\n}","preventionTips":["Set up the [encryption] block before adding encrypted_ files.","Run `chezmoi doctor` to confirm gpg/age is available.","Test `chezmoi apply` after config changes."],"tags":["encryption","configuration","missing-config"],"backgroundTag":"missing-configuration","analyzedSha":"f901167e4685db90da56d6a2a19df642cb3e0247","analyzedAt":"2026-09-01T18:16:41.508Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}