I have a site in development, that is basically crippled, because of this issue.

I was installing an additional module when I got:

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

I have encountered this error quite a bit in Drupal 8.x, typically, I was able to simply click the "Back" button on my browser, and save again, and I was fine; but in this instance, I am basically stuck; as the site is now completely locked up. I can click "back" and get to the previous screen, however ANYTHING I attempt to do, yields the "The website encountered an unexpected error. Please try again later." message. I cannot even view the front end (even from another machine).

The site is "Online", while not yet a "production site", it is on a live host. I have gone in and deleted the folder for the last module I installed, and I have cleared the cache, both with Drush and via PHPAdmin, but no change.

I'm not even able to get to the area in the admin menu to view error logs.

I would appreciate any help resolving this.

Files: 
CommentFileSizeAuthor
#20 git.png68.8 KBBEGRAFX
#20 mine.png16.31 KBBEGRAFX

Comments

BEGRAFX created an issue. See original summary.

cilefen’s picture

Category: Task » Bug report
Status: Active » Postponed (maintainer needs more info)

The real error will have been logged by the web server. Look at its error log and post the details.

BEGRAFX’s picture

The error (at least in this instance) appears to be:

[Mon Dec 12 09:32:10.215655 2016] [fcgid:warn] [pid 167299:tid 139980378658560] [client {IP Address}:53955] mod_fcgid: stderr: Uncaught PHP Exception Twig_Error_Runtime: "The "Twig_Extension_Sandbox" extension is not enabled in "{# inline_template_start #}{{ value|nl2br }}"." at /home/begrafx/public_html/openchurch-8/vendor/twig/twig/lib/Twig/Environment.php line 770

cilefen’s picture

Title: The website encountered an unexpected error. Please try again later. » Uncaught PHP Exception Twig_Error_Runtime: "The "Twig_Extension_Sandbox" extension is not enabled
Status: Postponed (maintainer needs more info) » Active

It would help to know the additional module you were installing that led to this. Oftentimes we have seen contributed modules that are still in heavy development.

Were there Drupal core updates installed during this timeframe?

BEGRAFX’s picture

I believe the module in question was Video Embed Field (https://www.drupal.org/project/video_embed_field), but I'm not 100% positive.

No, no Drupal Core updates installed during this time.

cilefen’s picture

Priority: Normal » Major
Issue tags: +Twig

The sandbox extension ought to be loaded into Drupal's twig environment by \Drupal\Core\Template\TwigEnvironment's constructor. Are there other notable errors, warnings or notices logged?

vaplas’s picture

@BEGRAFX, perhaps it was one of these:

calendar, commerce, components, devel, devel_debug_log, entity_embed, little_bobby_tables, md_fontello, partial, pc, responsive_svg, sitecommander, skillset_inview, tlh, transliterate, tve, twig_clean_debug, twig_extensions, twig_field_value, twig_link_attributes, twig_php, twig_renderable, twig_tweak, twig_whitespace_collapser, twig_xdebug, webprofiler, wxt_library ?)

You can look at time of creation folder modules?

Google also knows a websites with this problem. And one of solution:

You can maybe try to remove vendor/twig/extensions and run composer install again.

BEGRAFX’s picture

Cilefen, I don't believe I added anything to do with twig, so that should be whatever comes stock with Drupal 8.

Vaplas: No, I don't believe I've added any of the modules you listed.

Here's the list from the MODULES folder:

audiofield, block_styles, bootstrap_library, fontyourface, give, live_weather, metatag, simplenews, styles_api, token, workbench, yoast_seo

When I checked again on my errors, I see this one now also (several times)

: No matching DirectoryIndex (index.html.var,index.htm,index.html,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directive

cilefen’s picture

The last error you posted is a web server (not PHP) error indicating you have directory without a default document that somebody is browsing. Is its incidence affiliated with the more serious error?

BEGRAFX’s picture

I'll check my directory structure and see what I can figure out.

BEGRAFX’s picture

OK, in researching, the DirectoryIndex error issue has been found, and resolved. (I had uninstalled another site, and the folder, with the SITES folder was still there. I'm not sure what was causing the error message, but when I completely removed the folder, that error message ceased.) So apparently it was unrelated to the other issue.

BEGRAFX’s picture

Vaplas: I didn't install it, but as I think about it, Calendar may be in there somewhere as part of the distro. If so, what would you suggest?

Can you walk me through removing the vendor/twig extensions and all? I'm still kinda new on the internals of Drupal, and I'd rather ask for help, than blow something up. :-D

Thanks!

cilefen’s picture

You are running a distribution. What was the upgrade procedure you followed?

vaplas’s picture

Just run composer update in root site. If Twig will not be changed, then remove vendor/twig folder and run again.

Calendar has a problem #2831535: TwigExtension not found, but I'm not sure that this is a suitable case. The first, try composer update. And what distro do you use?

BEGRAFX’s picture

Cilefen: Yes, running a distribution. While I have added a couple modules, I haven't updated core or the distro.

Vaplas: I will try that. The site uses the OpenChurch distro.

cilefen’s picture

Sorry, I had this confused with another issue. Can you reproduce this issue with a plain (non-distro) Drupal 8.2.4 in that environment?

BEGRAFX’s picture

OK, I ran the composer update which ran without error, and now I am able to see the front end of the site, which is a step in the right direction. However, when I attempt to login I get:

[Wed Dec 14 08:17:38.998374 2016] [fcgid:warn] [pid 34590:tid 139980410128128] [client 65.175.186.28:60872] mod_fcgid: stderr: Uncaught PHP Exception RuntimeException: "Failed to start the session because headers have already been sent by "/home/begrafx/public_html/openchurch-8/modules/block_styles/modules/block_styles_bootstrap/block_styles_bootstrap.module" at line 2." at /home/begrafx/public_html/openchurch-8/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php line 140, referer: {My URL}/user/login

This error is basically greek to me.

cilefen’s picture

The fact that a composer update fixed the first problem suggests the Drupal files were missing or damaged. I strongly recommend you start working with source control (usually, git), in order to track and understand changes to the codebase.

block_styles_bootstrap.module contains no code, so I suspect there is damage to that file as well. Does it look like the one I just linked to?

vaplas’s picture

Nice! It is simple error about space in php output. Remove all space at the beginning of the file '/home/begrafx/public_html/openchurch-8/modules/block_styles/modules/block_styles_bootstrap/block_styles_bootstrap.module'. And may be convert it to UTF-8 without BOM.

BEGRAFX’s picture

FileSize
16.31 KB
68.8 KB

Cilefen & Vaplas: my /modules/block_styles/modules/block_styles_bootstrap/block_styles_bootstrap.module file looks exactly like the one you linked to. (see examples) I s'pose I can resave it, to make sure that it is UTF-8 and all.

...I attempted to just save it again, and my editor wouldn't, saying there were no changes to save, so I pulled that blank line (line #8) out, and saved it, and attempted to log in, and I'm able to get in... Let me check things over, and see if I find any other issues, but at this point it appears to be working. Thank you for your help.

darrenwh’s picture

Changing to fixed pending any further feedback from reporter.

darrenwh’s picture

Status: Active » Fixed
darrenwh’s picture

Status: Fixed » Closed (works as designed)

Sorry this closure is more approriate

vaplas’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Closed (works as designed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

nvahalik’s picture

I can also verify that doing a composer update fixed this problem for me. Drupal 8.2.3.