{"record":{"id":"69e9976e06620c39","repo":"symfony/http-kernel","slug":"unable-to-store-the-metadata","errorCode":null,"errorMessage":"Unable to store the metadata.","messagePattern":"Unable to store the metadata\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"HttpCache/Store.php","lineNumber":232,"sourceCode":"        $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']);\n\n        foreach ($this->options['private_headers'] as $h) {\n            unset($headers[strtolower($h)]);\n        }\n\n        array_unshift($entries, [$storedEnv, $headers]);\n\n        if (!$this->save($key, serialize($entries))) {\n            throw new \\RuntimeException('Unable to store the metadata.');\n        }\n\n        return $key;\n    }\n\n    /**\n     * Returns content digest for $response.\n     */\n    protected function generateContentDigest(Response $response): string\n    {\n        return 'en'.hash('xxh128', $response->getContent());\n    }\n\n    /**\n     * Invalidates all cache entries that match the request.\n     *\n     * @throws \\RuntimeException\n     */","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/symfony/http-kernel/blob/aa3a39d7286a62cdfea98f0e69c651a3da6e36cf/HttpCache/Store.php#L214-L250","documentation":"After persisting the response body, Store::write() serializes the request env and response headers as the cache metadata and calls save() on the metadata key. If that save fails, the RuntimeException is thrown because a cache entry without metadata is unusable.","triggerScenarios":"Store::save($key, serialize($entries)) returns false during write(): unwritable or full cache storage, or a custom Store overriding save() with failing behavior for the metadata key.","commonSituations":"Same filesystem issues as entity storage but discovered while writing the metadata file: permissions after deploys (different deploy user), read-only mounts, disk full.","solutions":["Make the cache directory writable by the web/PHP user","Free disk space or increase quota","Clear the cache (rm -rf var/cache or cache:clear) after fixing permissions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"is_dir($cacheDir) && is_writable($cacheDir) || throw new \\RuntimeException(\"Cache dir $cacheDir not writable\");","typeGuard":null,"tryCatchPattern":"try {\n    $store->write($request, $response);\n} catch (\\RuntimeException $e) {\n    $logger->error('HTTP cache metadata write failed: '.$e->getMessage());\n    return $response;\n}","preventionTips":["Deploy with the same user that runs PHP-FPM","Check for read-only mounts in containers","Alert on disk usage thresholds"],"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"}