{"record":{"id":"c3f0718ec74ac70b","repo":"symfony/routing","slug":"the-routing-file-s-contains-unsupported-keys-for-s-s","errorCode":null,"errorMessage":"The routing file \"%s\" contains unsupported keys for \"%s\": \"%s\". Expected one of: \"%s\".","messagePattern":"The routing file \"(.+?)\" contains unsupported keys for \"(.+?)\": \"(.+?)\"\\. Expected one of: \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Loader/ContentLoaderTrait.php","lineNumber":217,"sourceCode":"        }\n    }\n\n    /**\n     * @throws \\InvalidArgumentException If one of the provided config keys is not supported,\n     *                                   something is missing or the combination is nonsense\n     */\n    private function validate(mixed $config, string $name, string $path): void\n    {\n        if (!\\is_array($config)) {\n            throw new \\InvalidArgumentException(\\sprintf('The definition of \"%s\" in \"%s\" must be an array.', $name, $path));\n        }\n        if (isset($config['alias'])) {\n            $this->validateAlias($config, $name, $path);\n\n            return;\n        }\n        if ($extraKeys = array_diff(array_keys($config), self::AVAILABLE_KEYS)) {\n            throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" contains unsupported keys for \"%s\": \"%s\". Expected one of: \"%s\".', $path, $name, implode('\", \"', $extraKeys), implode('\", \"', self::AVAILABLE_KEYS)));\n        }\n        if (isset($config['resource']) && isset($config['path'])) {\n            throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" must not specify both the \"resource\" key and the \"path\" key for \"%s\". Choose between an import and a route definition.', $path, $name));\n        }\n        if (!isset($config['resource']) && isset($config['type'])) {\n            throw new \\InvalidArgumentException(\\sprintf('The \"type\" key for the route definition \"%s\" in \"%s\" is unsupported. It is only available for imports in combination with the \"resource\" key.', $name, $path));\n        }\n        if (!isset($config['resource']) && !isset($config['path'])) {\n            throw new \\InvalidArgumentException(\\sprintf('You must define a \"path\" for the route \"%s\" in file \"%s\".', $name, $path));\n        }\n        if (isset($config['controller']) && isset($config['defaults']['_controller'])) {\n            throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" must not specify both the \"controller\" key and the defaults key \"_controller\" for \"%s\".', $path, $name));\n        }\n        if (isset($config['stateless']) && isset($config['defaults']['_stateless'])) {\n            throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" must not specify both the \"stateless\" key and the defaults key \"_stateless\" for \"%s\".', $path, $name));\n        }\n        if (isset($config['firewall']) && isset($config['defaults']['_firewall'])) {\n            throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" must not specify both the \"firewall\" key and the defaults key \"_firewall\" for \"%s\".', $path, $name));","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/symfony/routing/blob/83fa223250b50f4f018c011e101c330e65ac63cc/Loader/ContentLoaderTrait.php#L199-L235","documentation":"validate() compares the definition's keys against the loader's AVAILABLE_KEYS allowlist and throws an InvalidArgumentException listing unsupported keys and the valid alternatives. This guards against typos and keys belonging to other loaders' schemas.","triggerScenarios":"Using keys not in self::AVAILABLE_KEYS, e.g. misspelled 'requirments', or keys valid in other config formats like 'condition' where unsupported, in the routing file at $path for route $name.","commonSituations":"Typoed config keys in YAML; copy-pasting options from another loader/bundle that uses a different schema; stale keys left after upgrades when the allowlist changed.","solutions":["Replace each listed unsupported key with the correct AVAILABLE_KEYS key (fix typos like 'requirments' -> 'requirements').","Remove keys that have no effect for this loader.","Check the loader's supported key list / documentation for the exact schema."],"exampleFix":"# before\nhome:\n    path: /\n    requirments:\n        id: \\d+\n# after\nhome:\n    path: /\n    requirements:\n        id: \\d+","handlingStrategy":"validation","validationCode":"$extra = array_diff(array_keys($config), self::AVAILABLE_KEYS);\nif ($extra) { throw new \\InvalidArgumentException('Unsupported keys: ' . implode(',', $extra)); }","typeGuard":null,"tryCatchPattern":"try { $loader->load($file); } catch (\\InvalidArgumentException $e) { /* rename/remove the unsupported keys listed */ }","preventionTips":["Run routing config lint (e.g. bin/console lint:yaml / config debug) in CI.","Copy option names only from the loader's documented schema.","Re-check config keys after loader upgrades."],"tags":["routing","config-validation","schema","symfony"],"backgroundTag":"schema-validation-failed","analyzedSha":"83fa223250b50f4f018c011e101c330e65ac63cc","analyzedAt":"2026-09-14T03:19:46.280Z","contentChangedAt":"2026-09-14T03:19:46.280Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}