But the post meta key is not created and no error is generated. The meta key doesn't exist in the postmeta table, yet

add_post_meta()

returns false and the key/value is never added.

Does anyone see what I'm doing wrong?

I'm not sure how to tell, but I think the [0] is a named key and not an index key. I say that because I can create more than one and delete the [0] element and the single element remaining still shows [1] using

In your if ( ! add_post_meta( $post_id, '_my_data', $my_data, true ) ) { you are using add_post_meta() function and last argument is set to true.It should be false instead, because you are inserting an array and NOT a string.
For this reason your if statement is not working properly.

Instead, your code should be (as add_post_meta last argument default value is false):