Custom form javascript -- file_get_contents(): failed to open stream

Created on 2 November 2017, over 7 years ago
Updated 16 June 2025, about 1 month ago

I'm seeing an intermittent but repeatable error that seems to be around the caching of per-webform custom javascript.

The error is:

Warning: file_get_contents(webform/javascript/form_machine_name): failed to open stream: No such file or directory in _locale_parse_js_file() (line 1134 of core/modules/locale/locale.module).

Worth noting is that even on pages that display the error, the custom javascript is being successfully executed. The error seems to be the locale module looking for something that's not available. (...Or maybe is no longer available by the time _locale_parse_js_file() is executed?)

Clearing the cache (via drush cr) causes the error to show consistently on the second subsequent webform admin-page load -- I was mostly testing with the Settings > Submissions tab. Once it's been shown it doesn't seem to appear again until after the cache is re-cleared or otherwise invalidated.

The error will also display after a drush cr on a public-facing page containing the form (positioned within a block). This seems less consistent -- it's usually on the second load, but sometimes on the first.

Strangely, it also occasionally shows on published pages that have nothing to do with the form at all, but as far as I can tell it's only shown after a page referencing the form has been loaded. (e.g. clear cache, load the public webform page, then load an unrelated public page.)

🐛 Bug report
Status

Fixed

Component

Code

Created by

🇬🇧United Kingdom jrsouth

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.71.5 2024