Ability to hide a button action not just the button in general

For now I’m hiding buttons to end a task when something is missing but the people think the app is not working correctly. So it would be great to show the hidden button but on click show an error message why the action behind it can’t be done. This is needed for many use cases in my apps.

A possible work around would be a separate button that only shows when the information is missing.

This could lead to a details page that shows the missing items.

Otherwise it could just open a modal of a page with a simple text that lets them know items are missing.