This is not directly mentioned in the Editing API spec, but all major browsers do this and there is a WPT for this behavior.
.execCommand("selectAll")
Disable the command if no selection is available. This is a spec bug: https://github.com/w3c/editing/issues/475 Fixes #3325