{"record":{"id":"1f5524673d569f6b","repo":"symfony/routing","slug":"the-routing-file-s-must-specify-the-attribute-package-of-the","errorCode":null,"errorMessage":"The routing file \"%s\" must specify the attribute \"package\" of the \"deprecated\" option for \"%s\".","messagePattern":"The routing file \"(.+?)\" must specify the attribute \"package\" of the \"deprecated\" option for \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Loader/ContentLoaderTrait.php","lineNumber":254,"sourceCode":"        }\n    }\n\n    /**\n     * 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":236,"sourceCodeEnd":264,"githubUrl":"https://github.com/symfony/routing/blob/83fa223250b50f4f018c011e101c330e65ac63cc/Loader/ContentLoaderTrait.php#L236-L264","documentation":"A 'deprecated' option on a route alias must include a 'package' attribute naming the composer package in which the alias is deprecated. ContentLoaderTrait::validateAlias() throws InvalidArgumentException when 'deprecated' is given without 'package', because deprecation notices need the package to attribute the notice correctly.","triggerScenarios":"A routing alias entry with a 'deprecated' key whose value lacks the 'package' attribute, e.g. deprecated: { version: '2.0' } or deprecated: true-like scalars.","commonSituations":"Following older docs or a half-remembered deprecation syntax; hand-editing deprecation metadata and dropping one attribute; tooling generating partial deprecation blocks.","solutions":["Add the missing 'package' attribute, e.g. deprecated: { package: 'acme/pkg', version: '2.0' }","Remove the 'deprecated' key entirely if the alias is not meant to be deprecated","Also verify 'version' is present, since it is required too"],"exampleFix":"# before\napp_new:\n    alias: app_old\n    deprecated:\n        version: '2.0'\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']['package'])) {\n    throw new \\LogicException('deprecated option requires a \"package\" attribute.');\n}","typeGuard":"function hasDeprecationPackage(array $config): bool { return !isset($config['deprecated']) || isset($config['deprecated']['package']); }","tryCatchPattern":"try { $collection = $loader->load($file, 'yaml'); } catch (\\InvalidArgumentException $e) { /* add package to deprecated block */ }","preventionTips":["Always include both package and version in 'deprecated'","Copy deprecation blocks from current Symfony docs","Validate alias entries in unit tests"],"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"}