zed-industries/zed · error
no version found for npm package {package_name} before {befo
Error message
no version found for npm package {package_name} before {before} What it means
Zed's NodeRuntime resolves npm package versions with an optional `before` cutoff (an RFC3339 timestamp from configuration, e.g. to pin a language-server release). It walks the registry's version list newest-first, keeping only versions published before the cutoff (and matching any semver requirement); when nothing qualifies it bails with the package name and the cutoff value.
Source
Thrown at crates/node_runtime/src/node_runtime.rs:534
if let Some(version) = latest_version
&& npm_version_was_published_before(version, &info.time, &before_timestamp)?
{
return Ok(version.clone());
}
for version in info.versions.iter().rev() {
if is_allowed_npm_version_before(
version,
latest_version,
&info.time,
&before_timestamp,
version_requirement.is_some(),
)? {
return Ok(version.clone());
}
}
bail!("no version found for npm package {package_name} before {before}");
}
info.dist_tags
.latest
.or_else(|| info.versions.pop())
.with_context(|| format!("no version found for npm package {package_name}"))
}
fn is_allowed_npm_version_before(
version: &Version,
latest_version: Option<&Version>,
published_at_by_version: &HashMap<String, String>,
before: &DateTime<Utc>,
allow_prereleases: bool,
) -> Result<bool> {
if (!allow_prereleases && !version.pre.is_empty())
|| latest_version.is_some_and(|latest_version| version > latest_version)
{View on GitHub (pinned to 9d272b0363)
Solutions
- Update or remove the `before` timestamp in configuration so at least one published version qualifies
- Relax the version requirement so a pre-cutoff version can match
- Pin an explicit version instead of relying on the cutoff heuristic
Example fix
// before (config): npm package pinned by an old cutoff "before": "2025-01-01T00:00:00Z" // after: cutoff newer than the release you want, or removed "before": null
Defensive patterns
Strategy: fallback
Validate before calling
async fn version_exists_before(
registry: &NpmInfo,
requirement: Option<&VersionReq>,
before: DateTime<Utc>,
) -> bool {
registry.versions.iter().any(|v| {
requirement.map_or(true, |r| r.matches(v))
&& registry
.time
.get(&v.to_string())
.and_then(|t| DateTime::parse_from_rfc3339(t).ok())
.map_or(false, |t| t.with_timezone(&Utc) < before)
})
} Try / catch
match select_npm_package_version(name, info.clone(), before, req) {
Err(e) if e.to_string().contains("before") => {
// degrade gracefully: newest matching version instead of cutoff pin
select_npm_package_version(name, info, None, req)
}
picked => picked,
} Prevention
- Keep `before` cutoffs newer than the package's oldest needed release
- Prefer explicit version pins over date cutoffs for rarely-published packages
- Treat cutoff resolution as best-effort: always define a no-match fallback
When it happens
Trigger: select_npm_package_version is called with a `before` date where every version matching the requirement was published after that date, all candidate versions were yanked or lack publish-time entries in registry metadata, or the package is brand new and postdates the cutoff entirely.
Common situations: A `npm_before` style config pinning an old date while the language server package only ships newer releases; a strict version requirement combined with an old cutoff; sparse registry metadata missing `time` for the only matching version.
Related errors
- copilot was not started because of an error: {error}
- GitHub Copilot native language server binary was not install
- npm package {name} declares no executable
- copilot is still starting
- capability for npm:install {package_name} is not granted by
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/2c81c20723703996.
Report an issue: GitHub.