restic: Improve error message if backend credentials are missing / invalid
Output of restic version
restic 0.8.3
compiled with go1.10 on linux/amd64
How did you run restic exactly?
restic -r s3:s3.amazonaws.com/backup.shrub.ca check
What backend/server/service did you use to store the repository?
Amazon S3
Expected behavior
Some sort of error, indicating that AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY is not defined.
Actual behavior
Fatal: unable to open config file: Stat: Access Denied.
Is there a repository at the following location?
s3:s3.amazonaws.com/backup.shrub.ca
Do you have an idea how to solve the issue?
If you define the expected variables, it runs:
# export AWS_ACCESS_KEY_ID=xxxx
# export AWS_SECRET_ACCESS_KEY=xxxx
# export RESTIC_PASSWORD=xxxx
# restic -r s3:s3.amazonaws.com/backup.shrub.ca check
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 7
- Comments: 18 (6 by maintainers)
I just burned by this one. Wouldn’t have scratched my head for so long if the error message was clearer. I definitely would have scratched my head for a lot longer if I hadn’t found the discussion here.
this is going to be a big issue in my environment where we are going to switch everything to instance profile, right now it is broken with version 0.9.5
There’s a difference between: • user supplied credentials which were invalid • user didn’t supply any credentials
You’re showing the same error in both cases. Further, the error is (somewhat) understandable to programmers, but not to end users.
Please indicate that no credentials were supplied and don’t attempt to connect in this case.
I also encountered this issue while trying to use instance roles. I was missing a permission in my IAM role policy:
s3:GetBucketLocationMy restic version is 0.9.6 and my error was:
After adding the missing permission it worked perfectly.
This error message is confusing, even for sophisticated users. restic appears to be simply printing the underlying (programmer) errors from
errno.hto users.Which config file was it trying to open? Was this a local or remote config file? What’s the path to this file? Why is the error message asking the user questions? Why is the word “fatal” present? Why is the word “stat” present?
A good error message should:
Here are examples of more helpful errors: