swc-project/swc · error

Option

Error message

Option<Targets>: {:?}

What it means

A todo!() in targets_to_versions (preset_env_base query.rs:213), companion to the Targets todo at line 211. It fires at the final step where the accumulated version map is converted to Option<Targets>; the conversion path is not finished, so any execution reaching it aborts with the debug dump of the Option<Targets> value being produced. It marks an unfinished branch of the query-to-versions pipeline.

Solutions

  1. Finish the Option<Targets> conversion branch in targets_to_versions
  2. Route around the unfinished branch by supplying explicit version targets instead of browserlist queries
  3. Report the configuration that reaches this path so it can be supported upstream
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/preset_env_base/src/query.rs:213 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17). Data as JSON: /api/errors/07844ce361e0b7d9. Report an issue: GitHub.

Appendix: source

Thrown at crates/preset_env_base/src/query.rs:213

            for (k, v) in map.iter() {
                match v {
                    QueryOrVersion::Query(q) => {
                        let (versions, is_unknown) = q.exec().context("failed to run query")?;
                        unknown_version = unknown_version || is_unknown;

                        for (k, v) in versions.iter() {
                            result.insert(k, *v);
                        }
                    }
                    QueryOrVersion::Version(v) => {
                        result.insert(k, Some(*v));
                    }
                }
            }

            unimplemented!("Targets: {:?}", map)
        }
        _ => unimplemented!("Option<Targets>: {:?}", v),
    }
}

#[cfg(test)]
mod tests {
    use super::Query;

    #[test]
    fn test_empty() {
        let (res, unknown_version) = Query::Single("".into()).exec().unwrap();
        assert!(
            !res.is_any_target(),
            "empty query should return non-empty result"
        );
        assert!(
            !unknown_version,
            "empty query should not be unknown version"
        );

View on GitHub (pinned to 5176682b65)