Getting an fatal error message when trying to render custom blocks on my node twig template I'm trying to render or print my custom blocks on my node twig template and currently receiving a fatal error message.

Argument 1 passed to Drupal\block\BlockViewBuilder::view()

Here is the snippet of code I'm working on my .theme file

function iom_preprocess_node(&amp;$variables) {

    $block = \Drupal\block\Entity\Block::load(917);
    $block_content = \Drupal::entityTypeManager()
      -&gt;getViewBuilder('block')
      -&gt;view($block);
}




$block returns NULL when I try to do a dump($block)

$block = \Drupal\block\Entity\Block::load(917);
dump($block);




Tried using twig tweak also to resolve the issue instead of having to pre-process it but no luck

{{ drupal_block('twitterfeed') }}
You can print blocks directly using Twig Tweak


  {# No need to configure this block on "admin/structure/block" page. #}
  &lt;dt&gt;Block:&lt;/dt&gt;
  &lt;dd&gt;{{ drupal_block('system_branding_block', {label: 'Branding', use_site_name: false}) }}&lt;/dd&gt;

  {# Bypass block.html.twig theming. #}
  &lt;dt&gt;Block (without wrapper):&lt;/dt&gt;
  &lt;dd&gt;{{ drupal_block('system_branding_block', wrapper=false) }}&lt;/dd&gt;



Source: Cheat sheet

Do not use the block's machine name, enable the devel and in block configuration click on Devel tab to get the Plugin ID.

For example, the Site Branding Block has machine name of sitebranding, but the plugin ID is system_branding_block