How do I programmatically update a UUID? Reason: Receiving uid does not exist error. Upon investigating, this error appears only when we edit or save the preexisting columns paragraph. If we create new columns paragraph, the error doesn't appear as the uuid is different for the newly created columns paragraph. 

This is the reason to update the uuid for a paragraph that is referenced on that page. In my custom module I have loaded all nodes using entity query below and loaded the referenced paragraph. 

$nids = \Drupal::entityQuery('node')
  -&gt;condition('type', 'page')
  -&gt;execute();
$nodes = \Drupal\node\Entity\Node::loadMultiple($nids);

  foreach ($nodes as $n) {
   //Relevant apragraph for the content type
   $para = $n-&gt;get('field_page_content')-&gt;getValue();
   $para_2 = $n-&gt;get('field_banner_image')-&gt;getValue();

   foreach($para as $e){
     $p = \Drupal\paragraphs\Entity\Paragraph::load($e['target_id']);

    if($p-&gt;bundle() == "columns"){
      kint($p,'Paragraph Entity');
      kint($p-&gt;uuid(),'Paragraph UUID');

       $uuid = 'd12da227-890b-4eb7-86b1-93937e7d6d91';

       //save paragraph
       //$p-&gt;save();

    }
  }
}


How can I get this updated without recreating the columns paragraph as there are quite a few.
Haven't tested this but I believe this is the route to go if you must add the uuid in this manner.

$uuid = 'd12da227-890b-4eb7-86b1-93937e7d6d91';
$p-&gt;set('uuid',$uuid);
$p-&gt;save();


Let me know if that doesn't work.