The website encountered an unexpected error. Please try again later

On installing modules it show this error page.
Screenshot_8

I’m running into a similar error right after a fresh install of farmos2.x. I enabled verbose logging by updating /sites/default/settings.php, adding this line:

$config['system.logging']['error_level'] = 'verbose';

Now this is the message I’m seeing on the home page:

The website encountered an unexpected error. Please try again later.

Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /" (from "http://<my-domain>/core/install.php?profile=farm") in Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest() (line 136 of /opt/drupal/vendor/symfony/http-kernel/EventListener/RouterListener.php).
Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object) (Line: 112)
Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object, 'kernel.request', Object)
call_user_func(Array, Object, 'kernel.request', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 134)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Could we be facing the same error?

@raheel Does this relate at all to the other forum topic you posted?

It would be easier if you just create a single topic and we work through your deployment issues one at a time. Your other topic suggests that you never got farmOS running, but in this one you said you tried to install a module, so I’m confused as to where you actually are in the process.

@gmagnusson I doubt this is the same issue you are encountering. I would suggest you create a dedicated topic as well and we can debug separately.

Alternatively, you are both welcome to join the farmOS chat room: https://app.element.io/#/room/#farmOS:matrix.org - If we are both online at the same time I may be able to help debug little issues like this.

First i encountered this when the farmOS was installing the module i selected in the installation process, i thought the issue is with docker container maybe it got corrupted or something, so i tried to redeploy it through docker, at that time i faced the {“Apache/2.4.38 (Debian) Server at localhost Port 80”} this one.

1 Like

I too have the same error

a brief about my setup

  1. i have successfully installed the farmos on self hosting docker (my yml reads as follows

version: ‘3’
services:
www:
# Update this to the latest stable version before deploying.
image: farmos/farmos:2.0.0-beta6
volumes:
- ‘./:/opt/drupal/web/sites’
restart: always
proxy:
image: nginx:stable-alpine
depends_on:
- www
ports:
- ‘80:80’
- ‘443:443’
volumes:
- ‘./nginx.conf:/etc/nginx/nginx.conf’
- ‘./ssl:/etc/nginx/ssl’

it was working perfect)
2) i have kept the files on external HDD which i use on my linux and windows machine (whichever is free)
3) first my installation was running ok on windows, then when i ran the yml file on linux, and changed to dark theme it was too fine on linux, but on next day when again i ran on windows, it was giving weired appearence > so tried the following
a) changing the theme,
b)clearing all caches,
c) uninstalling and reinstalling the theme
but all were not working (it was not displaying properly on linux too then)
d) then i changed to one of the listed themes in farmos and uninstalled all other themes

after that this error came,

can anyone pl guide me how to get rid of this and again get my site up?
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\block\BlockViewBuilder::view() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /opt/drupal/web/profiles/farm/modules/core/ui/user/src/Controller/ErrorPageController.php on line 27 in Drupal\block\BlockViewBuilder->view() (line 31 of core/modules/block/src/BlockViewBuilder.php).

Drupal\block\BlockViewBuilder->view(NULL) (Line: 27) Drupal\farm_ui_user\Controller\ErrorPageController->on403() call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 564) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 158) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 2) (Line: 80) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 2, 1) (Line: 67) Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 2, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 2, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 2, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 2, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 2, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 2) (Line: 166) Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest(Object, ‘/403’, 403) (Line: 119) Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->makeSubrequestToCustomPath(Object, ‘/403’, 403) (Line: 71) Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->on403(Object) (Line: 109) Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException(Object, ‘kernel.exception’, Object) call_user_func(Array, Object, ‘kernel.exception’, Object) (Line: 142) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, ‘kernel.exception’) (Line: 219) Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 91) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67) Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Hi @perfectinfo - Your error appears to be due to changing themes.

farmOS by default expects the Gin theme to be used. farmOS includes a module called farm_ui_theme which makes some modifications to various UI elements to work with Gin, and therefore assumes Gin is being used. If you want to experiment with other themes then you must uninstall farm_ui_theme first. But I would not recommend doing this unless you know what you are doing. farmOS is built on Drupal, which provides a lot of options for changing themes, but these are not officially supported by farmOS so you are on your own if you experiment with them.

Are you able to re-enable the Gin theme?

could you pl guide me how to re-enable the Gin theme (i have already uninstalled it)? is there a way to extract my data safely (from this crashed site without backup) and reinstall again? i cant login with the error as mentioned in my previous post

Two things you could try:

(1) In the same directory as your docker-compose.yml file run this command:

sudo docker-compose exec -u www-data www drush theme:enable gin

That will attempt to re-enable Gin via the command line.

If that doesn’t work…

(2) Try uninstalling farm_ui_theme with this:

sudo docker-compose exec -u www-data www drush pm-uninstall farm_ui_theme

That will attempt to uninstall the farm_ui_theme module. Note that it will prompt you to uninstall farm_ui as well, which is OK.

If that works, then you should be able to log back into the site, re-enable Gin manually (via /admin/appearance), then you can re-enable farm_ui (which will also enable farm_ui_theme) with:

sudo docker-compose exec -u www-data www drush pm-uninstall farm_ui

Hope one of those works! :crossed_fingers:

1 Like

i get following error
ERROR: No such service: drush

1 Like

Oh oops - there’s supposed to be a www between www-data and drush… like this:

sudo docker-compose exec -u www-data www drush pdrush theme:enable gin

My bad. Try that. :slight_smile:

Wow I need to look more closely before I click “Send”… :smile:

Third time is a charm:

sudo docker-compose exec -u www-data www drush theme:enable gin

(I edited my previous post to correct the commands in the original instructions.)

[success] Successfully enabled theme: gin

but the initial error (The website encountered an unexpected error. Please try again later.) still persists

Ah ok - So then try the second method I described.

I think this just means that Gin was enabled, but it wasn’t set as the default theme. So you’ll need to do that too (before re-enabling farm_ui).

tried second method but still no success,
how to re-enable? (as i am unable to go past 1st error / site is not accessible)
how to check / list the installed themes? (i doubt as i had mentioned earlier, i uninstalled it thru UI)

i have reinstalled the site,
one suggestion,

kindly specify not to play with themes in installation section of farmos installation manual

That’s one way to do it! Hope you didn’t lose any data.

kindly specify not to play with themes in installation section of farmos installation manual

Not a bad idea to include some kind of “Intro to Drupal considerations” section in the docs. We had something like that in the v1 docs: Update Safety - farmOS.org