Why doesn't hook_preprocess_node() get triggered? I use the following code in a theme whose machine name is yokai.

// works like expected, output visible
function yokai_preprocess_html(&amp;$variables) {
  dpm('yokai_preprocess_html');
  dpm($variables);
}

// does not work, no output visible
function yokai_preprocess_node(&amp;$variables) {
  dpm('yokai_preprocess_node');
  dpm($variables);
}


Why doesn't hook_preprocess_node() get triggered?
The problem is with dpm(). This uses drupal_set_message(), which uses the session variable to store messages:

function dpm($input, $name = NULL, $type = 'status') {
  if (\Drupal::currentUser()-&gt;hasPermission('access devel information')) {
    $export = kprint_r($input, TRUE, $name);
    drupal_set_message($export, $type, TRUE);
  }
  return $input;
}


When the node template is processed, the page is already built with the session variables at this point. Any messages that come later will not make it on the page. In this case better use kint(). dpm() is more usefull for debugging code that doesn't produce a page output, like form validation.