denoland/deno · error
Invalid filter "{input}"
Error message
Invalid filter "{input}" What it means
`deno outdated` accepts package filters of the form pkg, pkg@<semver-range>, or @scope/pkg@<semver-range>. The filter is split on '@' and any version part must parse as a semver range; failures are reported as an invalid filter. The bare form of this message (empty pattern after splitting) is effectively defensive and near-unreachable.
Source
Thrown at cli/tools/pm/outdated/mod.rs:753
if let Some(scope_name) = s.strip_prefix('@') {
if let Some(idx) = scope_name.find('@') {
let (pattern, version_spec) = s.split_at(idx + 1);
(
pattern,
Some(
VersionReq::parse_from_specifier(
version_spec.trim_start_matches('@'),
)
.with_context(|| format!("Invalid filter \"{input}\""))?,
),
)
} else {
(s, None)
}
} else {
let mut parts = s.split('@');
let Some(pattern) = parts.next() else {
return Err(anyhow!("Invalid filter \"{input}\""));
};
(
pattern,
parts
.next()
.map(VersionReq::parse_from_specifier)
.transpose()
.with_context(|| format!("Invalid filter \"{input}\""))?,
)
};
Ok(Filter {
kind,
regex: pattern_to_regex(pattern)
.with_context(|| format!("Invalid filter \"{input}\""))?,
version_spec,
})
}View on GitHub (pinned to 89f33cbef2)
Solutions
- Start with a bare name: deno outdated pkg
- When bounding updates, use valid range syntax: pkg@^1.2 or @scope/pkg@~2.0
- Single-quote the whole filter so operators and spaces survive the shell
- Check for a stray '@' with no version after it
Example fix
# before deno outdated 'chalk@latest' # after deno outdated chalk # or: deno outdated 'chalk@^4.0.0'
Defensive patterns
Strategy: validation
Validate before calling
// validate a deno outdated filter before shelling out
import semver from "npm:semver";
function checkFilter(input: string): boolean {
const i = input.lastIndexOf("@");
if (i <= 0) return true; // no version part (covers plain and scoped names)
const range = input.slice(i + 1);
return range === "" || semver.validRange(range) !== null;
} Type guard
function isSemverRange(s: string, validRange: (r: string) => string | null): boolean {
return validRange(s) !== null;
} Prevention
- Prefer bare package names unless you truly need to bound the update
- Always single-quote the filter so shell operators survive intact
- Remember dist-tags like latest are not valid range syntax here
When it happens
Trigger: Passing a filter whose version part is not a valid semver range, e.g. `deno outdated 'pkg@two'` or a shell-mangled range like '>=1 <2'; stray leading/trailing '@' (e.g. 'pkg@')
Common situations: Typos in ranges; copy-pasting npm dist-tags (latest, next) where a range is expected; shell quoting splitting the filter into multiple arguments.
Related errors
- The bench name can't be empty
- invalid doc test hashbang: #!/bin/sh (binary basename needs
- invalid doc test hashbang: #!/usr/bin/env -S deno run --allo
- Bench failed because the "only" option was used
- Bench failed
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/b45bc1a61e4f0f52.
Report an issue: GitHub.