Meta inserted through wp_insert_post gets messed up

So I ended up just adding the meta after inserting the post, which doesn’t give any error. It bypasses the problem without explaining it though…

$postarr = array(
    'post_title'    => $link['caption'],
    'post_type'     => 'ct_external_link',
    'post_status'   => 'publish',
    'post_excerpt'  => $link['caption'],
);

$external_link_id = wp_insert_post($postarr);

if( !empty($external_link_id) ) {
    add_post_meta($external_link_id, 'ct_external_link_url', $doc['file'], true);

    if( isset($doc['hide']) ) {
        add_post_meta($external_link_id, 'ct_hide_from_frontent', $doc['hide']);
    }
}