WP-CLI not setting page template with page_template=”template-name.php”

I wrote this as a comment, but should have put it here.

The problem was that my templates were in a folder in my theme called “templates”

I found this out by doing:

wp post meta list post_name="post-name" 

and is showed that it is in the folder templates. Then I changed the above code to

wp post create --post_type=page --page_template="template/template-name.php" 

This worked fine

error code: 523