post_exists stops working in a scheduled event

I found the answer to my own question. I am leaving this here in case anyone else runs into the same issues. Basically, post_exists() wants detecting duplicate posts because I didn’t put a file path for it.

I needed to include within the function.

require_once ABSPATH . '/wp-admin/includes/post.php';