I create a Block Plugin in a module, it be showing the available blocks but when I try to place the block, it returns in the browser console the follow error:

AjaxError: An AJAX HTTP error occurred. HTTP-resultaatcode: 500 Debug informatie volgt. Pad: /admin/structure/block/add/hello_block/bartik?region=footer_fourth Statustekst: Internal Server Error Antwoordtekst:

I have place the code on the follow place: DrupalRoot/modules/pagebuilder/src/Plugin/Block/testblock.php


 * @file
 * Contains \Drupal\pagebuilder\Plugin\Block\testblock.
namespace Drupal\pagebuilder\Plugin\Block
use Drupal\Core\Block\BlockBase;

 * Provides a 'Hello' Block
 * @Block(
 *   id = "hello_block",
 *   admin_label = @Translation("Hello block"),
 * )
class testblock extends BlockBase {

     * {@inheritdoc}
    public function build() {
        return array(
            '#markup' => $this->t('Hello, World!'), 

How can i fix this problem?

  • Hi Andre van der Laan , I am facing the same error, would like to know how you fixed it?
    – harshal
    Commented Jan 26, 2016 at 12:57

1 Answer 1


When developing and encounter 500 errors, you should see if Drupal has logged the error or your webserver has logged the error. Depending on your configuration you might be able to see a full stacktrace explaining the error.

In this case you are missing a ; after your namespace declaration. So

namespace Drupal\pagebuilder\Plugin\Block

Should be

namespace Drupal\pagebuilder\Plugin\Block;

This should fix your error.

  • I ran into this issue. Following @googletorp's instructions lead me to an error that revealed I had the used the wrong namespace. Drupal\example_module\Plugin\Block instead of Drupal\child_menu_list\Plugin\Block ... in my example. Thanks for the reminder! Commented Aug 22, 2016 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.