How to fix the WSOD and error message you have requested a non-existent service cache.backend.permanent_database

Created on 29 November 2023, 12 months ago
Updated 9 December 2023, 12 months ago

Problem/Motivation

How to resolve "You have requested a non-existent service cache.backend.permanent_database"

Steps to reproduce

Install the PCB module
create a module.services.yml e.g. tea_voting.yml

services:
  cache.voting:
    class: Drupal\Core\Cache\CacheBackendInterface
    tags:
      - { name: cache.bin, default_backend: cache.backend.permanent_database }
#      - { name: cache.bin}
    factory: cache_factory:get
    arguments: [voting]

Clear Drupal caches
Change the module.services.yml e.g. tea_voting.yml by removing the cache.backend.permanent_database so it looks like:

services:
  cache.voting:
    class: Drupal\Core\Cache\CacheBackendInterface
    tags:
#      - { name: cache.bin, default_backend: cache.backend.permanent_database }
      - { name: cache.bin}
    factory: cache_factory:get
    arguments: [voting]

This effectively makes your cache.voting service a "normal" cache. i.e. it can be cleared with a Drupal cache clear.
Clear Drupal cache
notices the WSOD and error message:

You have requested a non-existent service "cache.backend.permanent_database". Did you mean this: "cache.backend.database"?

Now the Drupal database does not recover and the site has a WSOD.

Proposed resolution

To fix this truncate the cache_container table

Remaining tasks

Update the documentation to reflect this. Other solutions welcome

📌 Task
Status

Postponed: needs info

Version

3.1

Component

Documentation

Created by

🇺🇸United States selwynpolit

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

Comments & Activities

Production build 0.71.5 2024