diff --git a/cmd/restic/global.go b/cmd/restic/global.go index 673d8bcaf..874a26408 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -206,6 +206,9 @@ func Exitf(exitcode int, format string, args ...interface{}) { func resolvePassword(opts GlobalOptions, env string) (string, error) { if opts.PasswordFile != "" { s, err := ioutil.ReadFile(opts.PasswordFile) + if os.IsNotExist(err) { + return "", errors.Fatalf("%s does not exist", opts.PasswordFile) + } return strings.TrimSpace(string(s)), errors.Wrap(err, "Readfile") }