{"record":{"id":"67b3e2bb28f8fa4b","repo":"symfony/http-foundation","slug":"you-cannot-guess-the-extension-as-the-mime-component-is-not-67b3e2","errorCode":null,"errorMessage":"You cannot guess the extension as the Mime component is not installed. Try running \"composer require symfony/mime\".","messagePattern":"You cannot guess the extension as the Mime component is not installed\\. Try running \"composer require symfony/mime\"\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"File/UploadedFile.php","lineNumber":149,"sourceCode":"    public function guessClientExtension(): ?string\n    {\n        if (!class_exists(MimeTypes::class)) {\n            throw new \\LogicException('You cannot guess the extension as the Mime component is not installed. Try running \"composer require symfony/mime\".');\n        }\n\n        return MimeTypes::getDefault()->getExtensions($this->getClientMimeType())[0] ?? null;\n    }","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/symfony/http-foundation/blob/5aea19cd678fa4140f6108406f1096de5e9ed6e4/File/UploadedFile.php#L131-L167","documentation":"A LogicException feature guard thrown by UploadedFile::guessClientExtension() when the symfony/mime package is not installed. The method maps the client-supplied mime type to a file extension, which is impossible without MimeTypes, so the call aborts; it signals a missing dependency rather than bad input.","triggerScenarios":"Thrown at File/UploadedFile.php:149 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run composer require symfony/mime to enable extension guessing","Guard with class_exists(MimeTypes::class) and return a default extension or null instead of guessing","Parse the extension from the original client filename (pathinfo($file->getClientOriginalName(), PATHINFO_EXTENSION)) as a fallback"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5aea19cd678fa4140f6108406f1096de5e9ed6e4","analyzedAt":"2026-09-13T01:52:22.855Z","contentChangedAt":"2026-09-13T01:52:22.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}