Error 500 when including controller file in Route I am trying to upgrade a mailing list from drupal 7 to 8. I am getting an 500 error when I include my controller in the route file. I checked the path in both route and controllers and almost tried removing all values from the class, still I am getting the error my route file is:

mailing_list.admin:
  path: '/admin/structure/mailing_list'
  defaults:
_controller:'\Drupal\mailing_list\Controller\MailingListController::mailingListList'
_title: 'Mailing List'
  requirements:
_permissions: 'administer mailing lists'


My Controller Code is:

namespace Drupal\mailing_list\Controller;
class MailingListController extends ControllerBase {
  public function mailingListList() {
$output = array('table', array('header' =&gt; '1'));
}
}


I have removed the lines in controller function to avoid 500 error, but still I am getting 500 error.
If that is the entirety of your controller, then you are missing use statement for ControllerBase.

namespace Drupal\mailing_list\Controller;

use Drupal\Core\Controller\ControllerBase;

class MailingListController extends ControllerBase {
  public function mailingListList() {
    $output = array('table', array('header' =&gt; '1'));
  }
}


You also need to return a Response or renderable array from the controller method the route calls.

Example:

namespace Drupal\mailing_list\Controller;

use Drupal\Core\Controller\ControllerBase;

class MailingListController extends ControllerBase {
  public function mailingListList() {
    $output = [];
    $output['#markup'] = $this-&gt;t('Hello!');
    return $output;
  }
}


See: https://www.drupal.org/docs/8/api/routing-system/introductory-drupal-8-routes-and-controllers-example

If that does not work you need to post the full error you are getting.