node_runtime: Tolerate non-string values in npm time metadata#57765
Merged
benbrandt merged 1 commit intoMay 27, 2026
Conversation
Some npm registries return `npm info --json` with non-string values in the `time` map. JFrog Artifactory emits `"unpublished": null`, and npm itself reports `unpublished` as an object once a package has had versions unpublished. Because `NpmInfo.time` was typed `HashMap<String, String>`, serde aborted deserialization with `invalid type: null, expected a string`, so `select_npm_package_version` never ran and language servers installed via npm failed to start. Only version keys in `time` are read (to honor npm's `before` cutoff), so deserialize it leniently: keep string-valued entries and drop the rest. The field type and downstream logic are unchanged.
benbrandt
approved these changes
May 27, 2026
Member
|
Thanks! |
TomPlanche
pushed a commit
to TomPlanche/zed
that referenced
this pull request
Jun 2, 2026
…dustries#57765) > [!NOTE] > Authored by Claude, but fixes a real issue I encountered; I have reviewed the diff Some npm registries return `npm info --json` with non-string values in the `time` map. JFrog Artifactory emits `"unpublished": null`, and npm itself represents `unpublished` as an object for packages that have had versions unpublished. Because `NpmInfo.time` was typed `HashMap<String, String>`, serde aborted the entire deserialization with `invalid type: null, expected a string`. As a result `select_npm_package_version` never ran, and language servers installed via npm (for example the tsgo extension, `tailwindcss-language-server`, and `json-language-server`) failed to start with an error like: ``` Failed to start language server "tsgo": invalid type: null, expected a string at line 100 column 23 ``` Only version keys in `time` are ever read (to honor npm's `before` cutoff), so this deserializes the map leniently: keep the string-valued entries and drop the rest. The field type and all downstream logic are unchanged. Added a regression test covering a `time` map containing `"unpublished": null`. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the UI/UX checklist - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed language servers failing to install when the npm registry returns non-string values (such as `"unpublished": null`) in package `time` metadata
This was referenced Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Authored by Claude, but fixes a real issue I encountered; I have reviewed the diff
Some npm registries return
npm info --jsonwith non-string values in thetimemap. JFrog Artifactory emits"unpublished": null, and npm itself representsunpublishedas an object for packages that have had versions unpublished.Because
NpmInfo.timewas typedHashMap<String, String>, serde aborted the entire deserialization withinvalid type: null, expected a string. As a resultselect_npm_package_versionnever ran, and language servers installed via npm (for example the tsgo extension,tailwindcss-language-server, andjson-language-server) failed to start with an error like:Only version keys in
timeare ever read (to honor npm'sbeforecutoff), so this deserializes the map leniently: keep the string-valued entries and drop the rest. The field type and all downstream logic are unchanged. Added a regression test covering atimemap containing"unpublished": null.Self-Review Checklist:
Release Notes:
"unpublished": null) in packagetimemetadata