{"record":{"id":"8bee4653c4fa298c","repo":"symfony/http-kernel","slug":"unable-to-store-the-entity","errorCode":null,"errorMessage":"Unable to store the entity.","messagePattern":"Unable to store the entity\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"HttpCache/Store.php","lineNumber":205,"sourceCode":"            }\n\n            $digest = $response->headers->get('X-Content-Digest');\n            if ($this->getPath($digest) !== $response->headers->get('X-Body-File')) {\n                throw new \\RuntimeException('X-Body-File and X-Content-Digest do not match.');\n            }\n        // Everything seems ok, omit writing content to disk\n        } else {\n            // Responses that cannot provide their content, like BinaryFileResponse or\n            // StreamedResponse, have no entity to store, so no entry is written\n            if (false === $content = $response->getContent()) {\n                return $key;\n            }\n\n            $digest = $this->generateContentDigest($response);\n            $response->headers->set('X-Content-Digest', $digest);\n\n            if (!$this->save($digest, $content, false)) {\n                throw new \\RuntimeException('Unable to store the entity.');\n            }\n\n            if (!$response->headers->has('Transfer-Encoding')) {\n                $response->headers->set('Content-Length', \\strlen($content));\n            }\n        }\n\n        // read existing cache entries, remove non-varying, and add this one to the list\n        $entries = [];\n        $vary = implode(', ', $response->headers->all('vary'));\n        foreach ($this->getMetadata($key) as $entry) {\n            if (!$this->requestsMatch($vary ?? '', $entry[0], $storedEnv)) {\n                $entries[] = $entry;\n            }\n        }\n\n        $headers = $this->persistResponse($response);\n        unset($headers['age']);","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/symfony/http-kernel/blob/aa3a39d7286a62cdfea98f0e69c651a3da6e36cf/HttpCache/Store.php#L187-L223","documentation":"Store::write() generates a content digest for the response body and calls save() to persist the body file; if the underlying Store::save() implementation fails to write the content, this RuntimeException is thrown because the cache entry would be incomplete.","triggerScenarios":"save() returns false during write() — usually the content file could not be written: full disk, wrong permissions on the cache directory, or a custom Store subclass whose save() fails for the digest key.","commonSituations":"Cache directory owned by another user or read-only in production; disk quota exceeded; NFS/network filesystem write failures; SELinux or open_basedir blocking writes to the cache path.","solutions":["Check the cache directory exists and is writable by the PHP process (e.g. chmod/chown var/cache)","Verify free disk space and inode/quota limits","Fix filesystem-level blocks (open_basedir, SELinux) or point the cache to a writable location"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$dir = ini_get('open_basedir') ? null : $cacheDir;\nis_dir($cacheDir) && is_writable($cacheDir) || throw new \\RuntimeException(\"Cache dir $cacheDir not writable\");\ndisk_free_space($cacheDir) > 1024 * 1024 || throw new \\RuntimeException('Cache disk nearly full');","typeGuard":null,"tryCatchPattern":"try {\n    $store->write($request, $response);\n} catch (\\RuntimeException $e) {\n    $logger->error('HTTP cache entity write failed: '.$e->getMessage());\n    return $response; // serve uncached instead of failing the request\n}","preventionTips":["Monitor free disk space on the cache volume","Ensure cache dir ownership matches the PHP user after deploys","Use cache:clear after permission changes"],"tags":["http-cache","file-write","symfony"],"backgroundTag":"file-write-failed","analyzedSha":"aa3a39d7286a62cdfea98f0e69c651a3da6e36cf","analyzedAt":"2026-09-13T18:03:36.509Z","contentChangedAt":"2026-09-13T18:03:36.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}