Skip to content

Restore-DbaDatabase - Empty backup selection is a silent no-op without -EnableException #10657

Description

@andreasjordan

Deferred from #10621 and PR #10631, which fixed the -EnableException half of the problem and explicitly left this half "for a maintainer decision". Since #10621 closes when that PR merges, the open half gets its own issue so it is not lost.

Behavior after #10631

When the backup information pipeline selects nothing restorable — diff/log backups without a full to anchor the chain, or a path holding no backups at all:

Decision to make

Should the non-exception path also treat an empty selection as a failure rather than a warn-and-return? Options discussed in #10621/#10631:

  1. Leave as is — warning only. Default dbatools behavior for soft failures; scripts that care can use -EnableException or check the (empty) return value.
  2. Make the bail-out louder without changing the contract — e.g. a clearly worded terminal warning stating that nothing was restored and why, instead of the current low-level "Fullname property not found".
  3. Treat it as an error even without -EnableException. Most protective, but a behavior change for callers who deliberately point the command at possibly-empty paths.

Option 2 is cheap and helps every caller; whether to go further is the maintainers' call.

This issue was created by Claude and reviewed by Andreas Jordan.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions