{"record":{"id":"f384019f541326fd","repo":"getgrav/grav","slug":"unknown-extension-type","errorCode":null,"errorMessage":"Unknown extension type ","messagePattern":"Unknown extension type ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php","lineNumber":170,"sourceCode":"        }\n\n        return null;\n    }\n\n    /**\n     * @param string $filename\n     * @return CompiledJsonFile|CompiledYamlFile|CompiledMarkdownFile\n     */\n    protected function getFile(string $filename)\n    {\n        $filename = $this->resolvePath($filename);\n\n        // TODO: start using the new file classes.\n        $file = match ($this->dataFormatter->getDefaultFileExtension()) {\n            '.json' => CompiledJsonFile::instance($filename),\n            '.yaml' => CompiledYamlFile::instance($filename),\n            '.md' => CompiledMarkdownFile::instance($filename),\n            default => throw new RuntimeException('Unknown extension type ' . $this->dataFormatter->getDefaultFileExtension()),\n        };\n\n        return $file;\n    }\n\n    /**\n     * @param string $path\n     * @return string\n     */\n    protected function resolvePath(string $path): string\n    {\n        /** @var UniformResourceLocator $locator */\n        $locator = Grav::instance()['locator'];\n\n        if (!$locator->isStream($path)) {\n            return GRAV_ROOT . \"/{$path}\";\n        }\n","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Framework/Flex/Storage/AbstractFilesystemStorage.php#L152-L188","documentation":"AbstractFilesystemStorage::getFile() maps the configured data formatter's default file extension to a compiled file class and only accepts '.json', '.yaml' and '.md'; anything else throws 'Unknown extension type'. The flex storage configuration therefore declares a formatter whose extension is unsupported by this storage backend (note that '.yml' is NOT accepted, only '.yaml').","triggerScenarios":"A flex collection/blueprint configured with storage: options: formatter: {class: ..., options: {file_extension: yml|neon|csv|txt}}; a custom formatter subclass that returns a different getDefaultFileExtension(); typos like 'yaml ' with a space or missing leading dot.","commonSituations":"Copy-pasting a flex blueprint and changing the format to 'yml' out of habit (other systems prefer it); writing a custom formatter for a niche format without also subclassing the storage; blueprint YAML indentation putting file_extension under the wrong key so a default leaks through.","solutions":["Set the formatter extension to one of the supported values: file_extension: json, yaml (not yml), or md.","If you need another format, implement a storage subclass overriding getFile() to return your own compiled file class.","Verify the option is actually reaching the formatter: check getDefaultFileExtension() on the configured formatter instance.","Watch for whitespace/missing dot in the configured value."],"exampleFix":"# before (flex blueprint)\nstorage:\n  class: Grav\\Framework\\Flex\\Storage\\FileStorage\n  options:\n    formatter:\n      class: Grav\\Framework\\File\\Formatter\\YamlFormatter\n      options:\n        file_extension: .yml\n\n# after\nstorage:\n  class: Grav\\Framework\\Flex\\Storage\\FileStorage\n  options:\n    formatter:\n      class: Grav\\Framework\\File\\Formatter\\YamlFormatter\n      options:\n        file_extension: .yaml","handlingStrategy":"validation","validationCode":"// Validate the formatter/extension pair before the flex type is used\n$ext = $formatter->getDefaultFileExtension();\nif (!in_array($ext, ['.json', '.yaml', '.md'], true)) {\n    throw new \\InvalidArgumentException(\n        \"Flex file storage supports .json/.yaml/.md, got '{$ext}'\"\n    );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use file_extension: .yaml — '.yml' is not accepted by this storage.","Stick to the bundled JsonFormatter/YamlFormatter/MarkdownFormatter for file storage.","For other formats, subclass the storage and override getFile() with your compiled-file class.","Lint flex blueprints (storage.options.formatter) in CI."],"tags":["grav","flex","storage","configuration","file-extension"],"backgroundTag":"unsupported-file-format","analyzedSha":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}