Cannot register a custom WP-CLI command

You are trying to add a subcommand to a non-existing command posts according to the error message.

Modify it to a single word command like posts-scan or add a subcommand to an existing command, like post.