TypeError: Drupal\package_manager\Validator\DiskSpaceValidator::temporaryDirectory(): Return value must be of type string, false returned in Drupal\package_manager\Validator\DiskSpaceValidator->temporaryDirectory()

Created on 12 January 2025, about 1 month ago

Problem/Motivation

Whenever I try accessing the following urls;
web/admin/config
/web/admin/reports/status

I get the following error message,
TypeError: Drupal\package_manager\Validator\DiskSpaceValidator::temporaryDirectory(): Return value must be of type string, false returned in Drupal\package_manager\Validator\DiskSpaceValidator->temporaryDirectory()

And whenever I try to clear the site cache I get the generic error;
The website encountered an unexpected error. Try again later.
Upon inspection of the watchdog table the last error is as below
Symfony\Component\DependencyInjection\Exception\RuntimeException, Cannot autowire service "Drupal\package_manager\Validator\LockFileValidator": argument "$keyValueFactory" of method "__construct()" references interface "Drupal\Core\KeyValueStore\KeyValueFactoryInterface" but no such service exists.
So, upon refresh the watchdog table doesn't get updated with any more messages.

Steps to reproduce

Accessing the following urls
web/admin/config
/web/admin/reports/status
Or trying to clear the cache

🐛 Bug report
Status

Active

Component

Track: Trial Experience

Created by

🇰🇪Kenya cholasni

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

Comments & Activities

  • Issue created by @cholasni
  • 🇮🇳India sourav_paul Kolkata

    @cholasni Could you please provide proper reproducing step?

    As i'm not getting any issue after clearing the cache & i've also visited the mentioned urls in which I've got 404 as it not a valid path
    I'm using drupal_CMS 1.0.0-rc1

  • 🇰🇪Kenya cholasni

    @sourav_paul Thank you for giving it a try, I've updated this issue's relationship.
    Please have a look at the parent issue as I document the whole experience.

    For some context, I was unable to successfully install Drupal CMS RC.
    After a successful install then some of the urls don't work.

  • 🇺🇸United States phenaproxima Massachusetts

    Adding 🐛 Don't try to automatically register Composer Stager services Active as a related issue, which I think will at least take care of the PreconditionInterface error.

  • 🇺🇸United States phenaproxima Massachusetts
  • 🇺🇸United States phenaproxima Massachusetts

    Let's deal with this error separately:

    TypeError: Drupal\package_manager\Validator\DiskSpaceValidator::temporaryDirectory(): Return value must be of type string, false returned in Drupal\package_manager\Validator\DiskSpaceValidator->temporaryDirectory()

    This can only happen if Drupal can't figure out where your temporary directory is. It uses the code in https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co... for this.

    The fact that it can't figure out a suitable temporary directory suggests that something is wrong with your system, or your hosting. Can you post some details about what your set-up is like?

  • 🇺🇸United States phenaproxima Massachusetts
  • 🇰🇪Kenya cholasni

    I've attached some files to show my local development setup.
    Also in my settings.php $settings['file_temp_path'] = '/tmp'; is already hardcoded.

  • 🇺🇸United States phenaproxima Massachusetts

    OK, a couple of things confuse me here.

    First of all, $settings['file_temp_path'] should not have anything to do with this, because \Drupal\Component\FileSystem\FileSystem::getOsTemporaryDirectory() doesn't look at settings at all. At least not as far as I can see.

    Secondly, it looks like you're on Windows; why would you set /tmp as the temporary directory anyway? That is a Unix-stye path so, as far as I know, it wouldn't work on Windows at all.

    Am I missing something here? Have you considered trying Drupal CMS with DDEV (which is the recommended way to set it up locally)?

  • 🇰🇪Kenya cholasni

    @phenaproxima On the issue of the temporary directory I agree that was a mistake.
    I just commented it out and assumed it should work, but as it's a Unix-style path on a Windows machine it seems not.

    On the issue of installing Drupal CMS with DDEV. (I had some issues with it related to WSL, Docker and working around ports)
    And it was really slow since I am doing it locally. I think I'll wait on the official release and see if the process will be smoother.
    In the meantime I'll continue testing till it works I really appreciate the step Drupal CMS RC is taking.

    Again thanks @phenaproxima you've been of great assistance.

  • 🇰🇪Kenya cholasni

    Okay so I gave the Drupal CMS rc installation a final shot... and, everything seems to be working fine all links are accessible no errors encountered so far ready I can finally test it out fully.

Production build 0.71.5 2024