{"record":{"id":"f6b89c3ba675f4c1","repo":"swc-project/swc","slug":"failed-to-parse-targets-f6b89c","errorCode":null,"errorMessage":"failed to parse targets","messagePattern":"failed to parse targets","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_ecma_preset_env/src/lib.rs","lineNumber":711,"sourceCode":"struct CoreJSConfig {\n    targets: Arc<Versions>,\n    included_modules: FxHashSet<String>,\n    excluded_modules: FxHashSet<String>,\n    /// True if the browserslist query returned an empty result (unknown browser\n    /// version).\n    unknown_version: bool,\n}\n\npub struct EnvConfig {\n    config: Config,\n    feature_config: Arc<FeatureConfig>,\n    core_js_config: CoreJSConfig,\n}\n\nimpl From<Config> for EnvConfig {\n    fn from(mut config: Config) -> Self {\n        let target_info = targets_to_versions(config.targets.take(), config.path.take())\n            .expect(\"failed to parse targets\");\n        let is_any_target = target_info.versions.is_any_target();\n\n        let (include, included_modules) = FeatureOrModule::split(config.include.clone());\n        let (exclude, excluded_modules) = FeatureOrModule::split(config.exclude.clone());\n\n        let feature_config = FeatureConfig {\n            targets: Arc::clone(&target_info.versions),\n            include,\n            exclude,\n            is_any_target,\n            unknown_version: target_info.unknown_version,\n            force_all_transforms: config.force_all_transforms,\n            bugfixes: config.bugfixes,\n        };\n        let core_js_config = CoreJSConfig {\n            targets: Arc::clone(&target_info.versions),\n            included_modules,\n            excluded_modules,","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_ecma_preset_env/src/lib.rs#L693-L729","documentation":"In From<Config> for EnvConfig in swc_ecma_preset_env, targets_to_versions failed to convert the configured targets (and optional browserslist path) into Versions. This fires at preset_env setup when the `targets` option is malformed — an invalid browserslist query, bad config file path, or wrongly shaped target map — so the transform cannot determine which syntax/features to compile down.","triggerScenarios":"Thrown at crates/swc_ecma_preset_env/src/lib.rs:711 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the `targets` field of the preset_env config for valid browserslist query syntax","Verify the browserslist config `path` points to an existing, valid file","Validate the same targets against the browserslist CLI","Use explicit version maps like { chrome: 80 } instead of free-form queries"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}