Skip to content

Fatal errors should be JSON formatted with --json #4948

@mikix

Description

@mikix

Output of restic version

restic 0.16.4 compiled with go1.22.2 on linux/amd64

What should restic do differently? Which functionality do you think we should add?

Currently, fatal errors aren't JSON formatted if --json is provided. It would be nice if it did surface that in a more programmatically-detectable way.

What are you trying to do? What problem would this solve?

Fatal errors can be detected by scanning for lines that start with Fatal: but still... it'd make me feel safer if I could instead scan for a JSON blob with "message_type": "fatal_error" though.

This would be especially handy if Restic ever wants to add more metadata to the error (like requested in #4947)

Open Questions

  • What should the message_type be? I could see an argument for fatal_error but I could also see an argument for just error (also used for per-file errors in backup/restore commands) with either a null path or a flag like "is_fatal: true`.
  • Should we keep printing the Fatal: freeform string to the console, to ease the transition for folks like me that are already looking for and parsing such lines?

I'm happy to work on a PR for this, if I could get some pre-guidance on the open questions. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions