Reviewed & tested by the community
Project:
Drupal core
Version:
main
Component:
composer
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jul 2026 at 06:37 UTC
Updated:
9 Jul 2026 at 15:32 UTC
Jump to comment: Most recent
Comments
Comment #2
philySame for me (running on ddev)
Comment #3
philyFixed by running
composer installafter updating the database ;-)Comment #4
kallado commented@phily Same here
Comment #5
cilefen commentedComment #6
cilefen commentedIt would be helpful if we could see the output of
composer updatewhen it causes the missing file.Comment #7
neurer commentedConfirming the issue. Running:
temporarily fixes it for me. Enabling preprocess reproduces the error reliably.
Comment #8
philyjust run
composer installafter the update, that will copy the missing file from the core/assets/scaffold folder, nothing more to do...Comment #9
neurer commentedYou're right. Running
composer installdoes address the 500 error. Aggregated CSS and JS still produces 404 for me though.Comment #10
phily@neurer D11.4.0 changed the
system.performance.ymlconfig file, replacinggzip: truetocompress: truefor bothcssandjsstatements.Is your config updated?
Comment #11
neurer commentedsystem.performance.ymlhas been updated to reflect changes.nginx confighas been updated to reflect changes -- with brotli commented out, as its anunknown directive "brotli_static".Aggregated CSS and JS keep producing 404 errors.
Comment #12
xtazcomposer installdo the job for me, thanks @philyComment #13
websiteworkspace commentedattempting to update from Drupal core 11.3.13 to core 11.4.0 caused catastrophic total site crash from which I have not yet been able to recover the site:
After core update, it is not possible to run {site}/update.php
After core update, the site issued an http "500" error.
After core update, drush update and and cache rebuild commands produce the following error output:
Comment #14
tclnj commentedNot sure if hsi table still needed after this, as I created it first, but here is SQL -
Comment #15
tclnj commentedRunning
composer installdid not resolvePHP Warning: require_once(autoload_runtime.php)error for me.Scaffolding kept replacing index.php with version referencing autoload_runtime.php, which continued to present error.
In the end, I reverted back to 11.3.13
Comment #16
frank.dev commented@#5
The update via Composer went off without a hitch, including the prompt for the symfony/runtime plugin.
Incidentally, I had most recently performed the same update process on a standard Drupal 11.3.13 installation set up specifically for this purpose, using only the core modules that are enabled for this purpose.
This was followed by the error messages I described above.
Comment #17
nattsRunning
composer dump-autoloadshould regenerate the autoload files, which may fix this issue. It did for me.Comment #18
xmacinfoI tried all of these to no avail:
composer dump-autoloadcomposer installcomposer update --lockComment #19
xmacinfoOk, the solution for me was to fix the permission issue on:
This prevented the whole scaffolding script to run.
After fixing that permission issue, just running
composer installfixed theautoload_runtime.phpbug.Comment #20
xmacinfoNow, what is the recommend approach to patch the
drupal/core-composer-scaffoldto force update the scaffold files the first time we load Drupal 11.4.x?Comment #21
lightweight commentedHi @xmacinfo - how did you fix the permissions? In my case the default.services.yml file is owned by the web user (www-data) but I still get the 'Could not delete /var/www/html/web/sites/default/default.services.yml:" error even if I make the file universally writable...
Never mind - I see that it's the `default` dir that needs the permission update.
Comment #22
xmacinfo@lightweight Try the
defaultfolder directly, not the file inside thedefaultfolder:chmod 777 /var/www/html/web/sites/defaultComment #23
lightweight commentedThanks for your help! Must've posted at just about the same time! Fixes this problem but reveals another one... sigh.
Comment #24
xmacinfoWhich new problem?
Comment #25
andres mejia commentedRunning composer dump-autoload works for me
Comment #26
muratk commentedUpdating to core 11.4.1 fixed it for us.
Comment #27
bluehead commentedI can confirm #18 sequence fixes the problem. Thank you @xmacinfo
Comment #28
jooxis commentedFirst you have to check file permissions to make sure that the update script will be able to write your sites/default directory.
Then Drush should be version 13.7 so that you don't get errors when trying to update database which prevents the script to create the autoload_runtime.php file.
If you previously ran the update and got the errors, you should check permission on sites/default folder or manually create the correct version of default.services.yml. Then upgrade Drush to correct version, flush cash and then run "composer install". If composer ran correctly run drush updatedb and then cash rebuild.
Comment #29
frodo.4 commentedConfirming this on 11.4.1 with web-root: "." Workaround that worked: manually creating [web-root]/autoload_runtime.php with return require __DIR__ . '/vendor/autoload_runtime.php';, mirroring the existing autoload.php stub.
Comment #30
abx commentedin my case with multiple drupal site.. all i did is
chmod 755 /sites/default
composer update
composer update
yes, run "composer update" twice, it works.. my problem is my default permission at "/site/default" is 555. Change it to 755 help with "Could not delete /sites/default/default.services.yml:" error.
Comment #31
cilefen commentedI am moving this to a support request due to the diversity of reports. Some comments point to #3091285: Composer scaffolding fails when permissions on default.settings.yml or default.settings.php is not writable..
Comment #32
xmacinfo@cilefen: Yes, “some”, but not all.
There is definitely a bug. It did not happen from 11.0 to 11.1, 11.1 to 11.2 and so on. But it happens from 11.3 to 11.4.
Comment #33
longwaveautoload_runtime.php is new in 11.4, but the Composer scaffold should put the right files in the right places. But #11 mentions CSS/JS aggregation, which is different, and then #13/14 are talking about help search, which is different again, so there's at least three separate problems here as far as I can tell.
Comment #34
neurer commentedReran this from backup:
composer installdoes address the 500. CSS/JS aggregation stops working instantly. As it turns out, the updated NGINX directives (https://www.drupal.org/node/3526344) weren't helpful. They validate fine though. Removing them does the trick. CSS/JS aggregation now works.Comment #35
catchI think the autoload_runtime issue is due to
#3091285: Composer scaffolding fails when permissions on default.settings.yml or default.settings.php is not writable.
Comment #36
sense-designAdded as #3091285: Composer scaffolding fails when permissions on default.settings.yml or default.settings.php is not writable. related
Comment #37
catchComment #38
xmacinfoShort answer: “No.”
Fixing manually the file permission on the
web/sites/defaultfolder does not fix theautoload_runtime.phpbug.After fixing the files permission on
web/sites/default, we still need to runcomposer installwhen upgrading from 11.3.x to 11.4.0 (or 11.4.1).Scenario one
If composer installs all the scaffolding files without permission error, run:
composer update -W(update from 11.3.x to 11.4.x)composer installScenario two
1.
composer update -W(update from 11.3.x to 11.4.x)If composer reports a permissions issue.
2. Fix the file permission (manually or with pre/post-drupal-scaffold-cmd commands in
composer.json#3091285: Composer scaffolding fails when permissions on default.settings.yml or default.settings.php is not writable..3. Run
composer installWhat I do to update to 11.4.1
1. If I did not add the “pre/post-drupal-scaffold-cmd” commands in
composer.json, I fix manually theweb/sites/defaultpermissions.2. I run
composer update -Wto get all files (upgrade from 11.3 to 11.4.1).3. Run
composer installon top.Note that if I omit to run
composer installon top of the composer update -W, I get a fatal error, even if I did correct the file permissions.Comment #39
kentr commentedHopefully this helps. For me this also occurs with
composer install.The
web/sites/default/default.*.*files and their directory are writable by the cli user:Here's the composer output:
And the output from running
composer install --no-devagain, which does createweb/autoload_runtime.php:Comment #40
longwaveIn #39 you are patching core with
cweagans/composer-patches. If you remove the patches section from your composer.json, do you still need to install for the second time?Comment #41
xmacinfoIn #39, when do you encounter the fatal 500 error, before running
composer install --no-dev?Or are you still stucked with a 500 error message after running
composer install --no-dev?Can you load the PHP error_log and give us the output? I want to see if this is related to the missing
autoload_runtime.phpfile.Comment #42
kentr commented@longwave,
Can you tell me how to repeat it? For me, once
composer install --no-devcorrectly creates the file, it always works—even if I manually deleteweb/autoload_runtime.phpand leave the patches in place. I've already done it on all environments for this site.@xmacinfo,
I run
composer install --no-devtwice. This was on deployment to stage / production, where I don't runcomposer updateat all.The error occurred after the first
composer install --no-dev, and was resolved by the secondcomposer install --no-dev.It's related. I tracked down this issue after I got the error about the missing
autoload_runtime.phpfile.Plus, I manually checked for the
autoload_runtime.phpfile. It was missing after the firstcomposer install --no-dev, and appeared as expected after the secondcomposer install --no-dev.Comment #43
kentr commented@longwave: actually, I'll try rolling back the composer changes completely to see if I can repeat it.
Comment #44
xmacinfo@kentr Perfect. Your second composer install fixes the missing file problem like it does for others on this issue. And based on your account, this is not related to file permissions.
To reproduce the problem
I maintain multiple Drupal 11 websites and on each of those, going from 11.3 to 11.4.1, the first composer command works without error, but the autoload_runtime.php is missing. When running composer install (after the first composer command), the
autoload_runtime.phpis created.My workflow
composer update -W500 error
composer installno more error.
Your workflow
composer install --no-dev500 error
composer install --no-devno more error.
file permissions
This issue about missing
autoload_runtime.phpis not related to files permissions. Although when we do have file permissions problems, the second composer command (install or install --no-dev) will not fix the missingautoload_runtime.phpfile.Comment #45
kentr commentedOk, repeated by going back to
11.3.13with composer and then going back up to11.4.1. I did not recreate the lock file after removing the patches fromcomposer.json, so there's the out-of-date lock file warning.After the first
composer install --no-dev,web/autoload_runtime.phpis missing and I get the corresponding fatal error in the browser.Output:
After the second
composer install --no-dev,web/autoload_runtime.phpnow exists and the fatal error is gone.Output:
Comment #46
catchI just ran the following to try to reproduce this from a clean install:
In that case autoload_runtime.php is getting created fine.
Note I didn't bother installing the site or anything nor changed permissions in any way.
@kentr and/or @xmacinfo would you mind trying the same steps? It would be good to rule out environment/composer version issues. Then if that works, maybe we can isolate what's different on the actual site installs that are running into this.
Comment #47
bugg_superstar29 commentedHere's how we were able to upgrade Core from 11.3.13 to 11.4.1:
The first
composer updatedoes not create theautoload_runtime.phpfile. However, runningcomposer installafterwards does create it. Now the site works in a localhost environment. But when deploying a new build artifact to one of our non-production environments, we get the WSOD and a message in the PHP error log saying thatautoload_runtime.phpdoes not exist.Back in my localhost environment, after running both
composer updateandcomposer install, a.gitignorefile in the same directory asautoload_runtime.phphasautoload_runtime.phplisted in it. I simply removed it from the.gitignorefile, redeployed a new build artifact, ran database updates and flushed caches viadrush, and voila!Comment #48
kentr commentedThe steps in #46 also worked for me;
web/autoload_runtime.phpwas created as expected.I'll try to recreate using the "bad"
composer.json, or post a diff for others to analyze.Comment #49
longwaveI can reproduce on a project of ours starting on 11.3.11:
Comment #50
longwaveI think we might be running into https://github.com/composer/composer/issues/6408
What happens is:
composer updateruns and downloads Drupal 11.4 including the updated pluginDrupal\Composer\Plugin\Scaffold\Handler::scaffold()fires - but this is still the Drupal 11.3 code so it doesn't know aboutautoload_runtime.phpWhen you next run a Composer operation, the 11.4 version of the plugin is used, which does work.
However it's not clear why this is working for some environments and not others!
Comment #51
longwaveOK, so looking at
\Drupal\Composer\Plugin\Scaffold\PluginI think I see what might be happening.handler()tries to lazy-loadDrupal\Composer\Plugin\Scaffold\Handlerclass in order to prevent this sort of situation.This is called from two events:
My hypothesis is that if
postPackage()is called *before*drupal/core-composer-scaffoldis updated, then the old 11.3 version ofDrupal\Composer\Plugin\Scaffold\Handleris loaded, and the autoload changes aren't there yet. If this happens *after*, then the 11.4 version is loaded instead, and everything works. I currently have no idea how to test this given it involves downloading and replacing code!We might be able to work around it by extracting the autoload_runtime code fromDrupal\Composer\Plugin\Scaffold\Handlerinto its own class that will only ever get autoloaded in the postCmd event, after the plugin has been updated? (as per the suggestion in https://github.com/composer/composer/issues/6408)edit: I don't think this is going to work, because whatever we instantiate needs to be referenced from the 11.3 codebase already?
Comment #52
longwaveManaged to reproduce my hypothesis on my project. Starting on a clean 11.3.11, I edited
vendor/drupal/core-composer-scaffold/Handler.phpand addeddebug_print_backtrace()to the constructor.After this, my changes to
vendor/drupal/core-composer-scaffold/Handler.phphave been removed as the file has been overwritten with the new version, and the nextcomposer installsucceeds as designed.I am not sure why the plugin is run twice, the second time with
eval(), but the Handler class itself is the stale version in both cases. Maybe theeval()is the workaround for my edit in #51: the plugin class itself is renamed and reloaded, so it *can* be self-updated?Comment #53
catchFor now should we add something to the release notes recommending that people un both
composer updateandcomposer installwhen updating to 11.4 and also double check that any build pipelines definitely include autoload_runtime.php in the artifact prior to a production deployment?I'm also wondering if we should consider backporting only the scaffolding changes to an extra patch release of 11.3 and maybe 10.6, then sites that get onto the latest versions of those first would already have the plugin so it would run properly when they update to 11.4. Although if we can find a permanent workaround for the loading weirdness that would obviously be a lot better.
Comment #54
catchTaking a look at scaffold, we currently use the handler for two things:
Would it help if we split that into two classes? e.g. if ::postPackage() gets called more often or earlier than ::postCmd()
edit:
The work in postPackages is to record things that later get used in the scaffold file, but that can still be two separate classes if we use a singleton/static for the post package stuff probably?
Comment #55
longwaveI believe postPackage gets called zero or more times depending on what is installed, and after that postCmd gets called exactly once.
Given the eval appears to ensure that Plugin.php is always reloaded with the new version for the postCmd at least, I think this is fixable in 11.4 with some careful refactoring.
Comment #56
longwaveWorking on a fix and test for this.
Comment #58
longwaveMR!16266 solves the issue by adding another method that generates
autoload_runtime.phpto\Drupal\Composer\Plugin\Scaffold\Plugin, which is guaranteed to be reloaded after the plugin itself is updated. There is also test coverage which emulates the previous version by removing that code and then upgrading the plugin in place.Parts of the fix and all of the test in this MR were written by Claude Code.
Comment #59
catchCouple more questions on the MR.
Bumping this to major since while there are workarounds (like running composer install) it's clearly been tripping a lot of people up.
Comment #60
longwaveThanks for reviewing, replied to all comments.
Comment #61
neurer commented@longwave May I suggest keeping "HTTP ERROR 500" in the issue title as it should make the issue easier to find for others. Something like: HTTP ERROR 500: Scaffold plugin does not always create autoload_runtime.php when upgrading to 11.4 will send more people in the right direction.
Comment #62
catchI have one minor nit in that I'm wondering if the test coverage should be in a new class, with a @todo to remove once we stop supporting updates from 11.3, so that its' easier/cleaner to remove it then. But that's very minor and this is urgent to get in, so moving to RTBC.