Check an AI-suggested package name on the registry before you install it

Look up the exact name on npm or PyPI before you install it, and install only when that page is the library the chat named.

Published 2026-11-21 · Translation: VI

What to do first

  • Copy the install line exactly, including any @scope/ and the punctuation inside the name.
  • Look that string up with npm view or python -m pip index versions. Those commands read a registry. They do not install the package.
  • Install only when the page’s name, its one-line description, and its source link are the library the chat described.

A model can name a package that is not in the registry. Spracklen, Wijewickrama, Sakib, Maiti, Viswanath, and Jadliwala measured that at USENIX Security 2025. The conference abstract calls these package hallucinations: fact-conflicting errors while generating code. Their ;login: article defines the case as a model recommending a package that does not exist in the default package repositories. The study used 16 models and 576,000 code samples in two languages. The average share of hallucinated packages was at least 5.2% for the commercial models and 21.7% for the open-source models, across 205,474 unique names. Those rates are that study.

That ;login: article, dated 17 June 2025, describes the next step. Someone notices a name the model repeats, publishes a package under that name, and the next person who follows the same suggestion installs it. In that article, about 45% of the hallucinated packages came back on every repeat of the same prompt, and about 60% showed up at least once across 10 later prompts. A missing name is the moment to stop. A page that appears on a later day is not evidence the model was right.

This is the same habit as a citation check: the chat handed you a name, and the name has to open onto the thing you are about to use.

Three questions. A missing name stops the install. A description of a different job stops it. A source link that is a different project stops it. Three yeses, and you install that name only.

A verified label on a PyPI link means the owner controlled that URL when the release was uploaded. It is not a scan of the files.

Read the registry the install will use

npm resolves a name by talking to a registry. The registry page for CLI 11 says the default is https://registry.npmjs.org, and that the URL follows the package scope. A scoped name such as @npm/example, the example in the package.json name rules, is not the unscoped name example. Those rules also say a new package must not contain uppercase letters. The name and the version together are the identifier.

npm view prints registry data. The npm-view page uses npm view connect as the example, and the default version is latest. On 21 November 2026, a GET of https://registry.npmjs.org/connect/latest returned name connect, version 3.7.0, description “High performance middleware framework”, and repository git+https://github.com/senchalabs/connect.git. That description is the line you compare with the chat. Connect, on this page, is a middleware framework: code that sits between a request and the application. A chat that called connect a database client does not match this page.

The same day, a GET of https://registry.npmjs.org/forgebench-daily-not-a-package returned HTTP 404 and {"error":"Not found"}. That string is a label for this article, not a library. Do not install it. If a page for it exists later, that page was not part of this reading.

PyPI documents the lookup as GET /pypi/<project>/json on the JSON API. The example there is sampleproject. The page says the metadata is what the publisher sent at upload time, and that it does not necessarily match the files. The first upload’s metadata for a release is the copy that stays. Later uploads of that same release do not update it. The same page says the downloads key is always -1 and should not be used.

On 21 November 2026, GET https://pypi.org/pypi/sampleproject/json returned name sampleproject, version 4.0.0, summary “A sample Python project”, and a Source URL of https://github.com/pypa/sampleproject/. downloads.last_day, last_week, and last_month were each -1. A GET for forgebench-daily-not-a-package returned HTTP 404 and {"message": "Not Found"}.

python -m pip index versions <package> is the pip command that inspects an index. The pip index page in the v26.3 docs shows peppercorn as the example and does not install it. The default index URL on that page is https://pypi.org/simple. If the project installs from another index, pass that same --index-url on the lookup. A miss on pypi.org is the wrong answer when pip install is pointed somewhere else.

Python compares names after normalization. The name specification lowercases the name and replaces every run of ., _, or - with a single -. Under that rule, friendly-bard, Friendly-Bard, friendly.bard, and friendly_bard are one name. On 21 November 2026, both GET /pypi/typing_extensions/json and GET /pypi/typing-extensions/json returned a project whose info.name is typing-extensions. GET /pypi/SampleProject/json returned info.name sampleproject. Compare that field. Do not “repair” the chat’s spelling into a neighbor that normalizes to a different name.

npm on the left, PyPI on the right. connect is one package, and @scope/connect is another. typing_extensions and typing-extensions are one PyPI project. friendly_bard and friendly-bard are one name under the spelling rule.

The friendly-bard line is the specification’s example of one name. This article did not install it. The typing-extensions pair is the one requested on 21 November 2026.

A found name can be the package someone else published

The ;login: article’s attack is not the 404. The 404 is the earlier state. After the name is published, the lookup succeeds, and the install is how the package gets onto the machine. A 200 means the registry has a project under that string. It does not mean the project is the library the chat described.

On PyPI, read the links with the limit printed on the project metadata page. PyPI shows three kinds of data: data PyPI itself manages, author data it verified at upload, and author data it did not verify. Project URLs are listed together, and the ones checked at upload are marked. The warning under verified links says the mark only attests that the package owner controlled that URL at upload time. It says nothing about the URL’s safety now, who owns it now, or whether it still belongs to the project. The check is not repeated. A URL can change hands, change content, or stop working, and keep the mark.

npm can run code during install, which is why the read comes first. The scripts page for CLI 11 lists preinstall, install, and postinstall under npm install, including npm install -g <pkg>, and says these run from the scripts of that package. A script is passed to /bin/sh on POSIX or cmd.exe on Windows. The same page says npm v7 does not implement uninstall lifecycle scripts. Installing so you can “see if it looks fine,” then removing the package, is not this check. The install scripts have already been handed to a shell, and npm will not run an uninstall script to undo them.

Keep a short note next to the command you were given:

2026-11-21
Command you were given:
Lookup: npm view <exact> | python -m pip index versions <exact>
Registry or index (the default, or the URL this project uses):
Result: missing | found
Name on the page:
One-line description:
Source link: opened | a different project | verified at upload only
Decision: install this name | do not install

Fill it from the page you opened. For the connect reading above, the name matches npm install connect, and the one-line description is a middleware framework. A chat that wanted a database client stops at the description, even though the name exists. For sampleproject, the summary is “A sample Python project” and the Source URL points at pypa/sampleproject. The -1 download fields stay out of the note.

Three skips. A missing name is not a license to install a neighbor. A downloads value of -1 is not a popularity score. npm install before the read has already run preinstall and install in a shell.

The third row is the one that already ran code. npm v7 will not run an uninstall script to take that back.

Watch-outs

  • A public 404 can be the wrong registry. npm chooses the registry from the scope. pip’s default index is https://pypi.org/simple, and --index-url replaces it. The lookup has to use the registry the install will use.
  • The rates belong to that study. 5.2%, 21.7%, 205,474, 45%, and 60% are the figures in the USENIX abstract and the 17 June 2025 article. They are not a rate for the chat window in front of you.
  • A matching page is not a review of the files. This check stops a missing name, a description of a different job, and a source link that is a different project. PyPI’s own JSON page says the metadata may not match the uploaded files. The license, the size, and who maintains it are the next note, in a dependency audit, once the name is the library you meant. An upgrade of a package already in the lockfile is a different pass.

Share

X Facebook LinkedIn
Educational content only. Rankings reflect stated criteria at the update date—not investment advice or permanent performance guarantees.