{"record":{"id":"03844d58be39f7d9","repo":"symfony/routing","slug":"the-routing-file-s-must-specify-the-attribute-version-of-the","errorCode":null,"errorMessage":"The routing file \"%s\" must specify the attribute \"version\" of the \"deprecated\" option for \"%s\".","messagePattern":"The routing file \"(.+?)\" must specify the attribute \"version\" of the \"deprecated\" option for \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Loader/ContentLoaderTrait.php","lineNumber":258,"sourceCode":"     * Validates that an alias definition only carries the `alias` and `deprecated` keys.\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 validateAlias(array $config, string $name, string $path): void\n    {\n        foreach ($config as $key => $value) {\n            if (!\\in_array($key, ['alias', 'deprecated'], true)) {\n                throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" must not specify other keys than \"alias\" and \"deprecated\" for \"%s\".', $path, $name));\n            }\n\n            if ('deprecated' === $key) {\n                if (!isset($value['package'])) {\n                    throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" must specify the attribute \"package\" of the \"deprecated\" option for \"%s\".', $path, $name));\n                }\n\n                if (!isset($value['version'])) {\n                    throw new \\InvalidArgumentException(\\sprintf('The routing file \"%s\" must specify the attribute \"version\" of the \"deprecated\" option for \"%s\".', $path, $name));\n                }\n            }\n        }\n    }\n}\n","sourceCodeStart":240,"sourceCodeEnd":264,"githubUrl":"https://github.com/symfony/routing/blob/83fa223250b50f4f018c011e101c330e65ac63cc/Loader/ContentLoaderTrait.php#L240-L264","documentation":"A 'deprecated' option on a route alias must include a 'version' attribute stating the release in which the alias was deprecated. ContentLoaderTrait::validateAlias() throws InvalidArgumentException when 'deprecated' omits 'version', since the deprecation message must tell users which version started the deprecation.","triggerScenarios":"A routing alias entry with deprecated: { package: 'acme/pkg' } — 'package' given but 'version' missing.","commonSituations":"Hand-written deprecation blocks where the version was forgotten; generated configs with incomplete metadata; copy-paste of examples that only showed 'package'.","solutions":["Add the 'version' attribute, e.g. version: '2.0', alongside 'package'","Remove the 'deprecated' key if no deprecation is intended","Validate that both package and version exist whenever editing alias deprecations"],"exampleFix":"# before\napp_new:\n    alias: app_old\n    deprecated:\n        package: 'acme/awesome-package'\n\n# after\napp_new:\n    alias: app_old\n    deprecated:\n        package: 'acme/awesome-package'\n        version: '2.0'","handlingStrategy":"validation","validationCode":"if (isset($config['deprecated']) && !isset($config['deprecated']['version'])) {\n    throw new \\LogicException('deprecated option requires a \"version\" attribute.');\n}","typeGuard":"function hasDeprecationVersion(array $config): bool { return !isset($config['deprecated']) || isset($config['deprecated']['version']); }","tryCatchPattern":"try { $collection = $loader->load($file, 'yaml'); } catch (\\InvalidArgumentException $e) { /* add version to deprecated block */ }","preventionTips":["Always include both package and version in 'deprecated'","Set version to the release where the alias became deprecated","Test route loading in CI to catch missing attributes early"],"tags":["symfony","routing","deprecation","route-alias"],"backgroundTag":"missing-required-config-field","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"}