Skip to main content

SKY-D225 · AI-code defects

Dependency version hallucination

High

A version hallucination is a pin to a release that was never published, such as flask==4.2.0 when Flask's newest major is 3. The package is real, the version is invented. SKY-D225 asks the registry whether each pinned version of a dependency exists.

Languages
Python (requirements.txt, pyproject.toml), JavaScript/TypeScript (package.json), Go modules, install commands in scripts, Dockerfiles, CI files and docs
Turned on by
skylos . --ai-defects (or -a) with network access to PyPI, the npm registry and the Go module proxy
Quality gate
counted toward the gate limits (full and diff scans). Counts toward max_ai_defects. HIGH findings do not fail the gate on their own unless block_ai_defect_severities under [tool.skylos.gate] lists "HIGH". The agent hook (skylos verify) blocks on it. skylos done lists it as advice unless unknown_imports = "block" is set under [tool.skylos.done.checks].
Finding type
review
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

The install fails in CI or, worse, on the next fresh deploy, long after the change was merged. A coding agent that sees the failure often "fixes" it by removing the pin, so the project then installs whatever the newest release is.

What Skylos flags

requirements.txt · TextReported on line 1
flask==4.2.0gunicorn==23.0.0

What Skylos leaves alone

requirements.txt · Text
flask==3.1.0gunicorn==23.0.0

Why Skylos leaves it alone

Flask 3.1.0 is a published release, so PyPI answers for that version and nothing is reported. Skylos reports a pin only when the registry knows the package but not the version.

More languages

JSON

Flagged

package.json · JSONReported on line 6
{  "name": "checkout-api",  "version": "1.0.0",  "private": true,  "dependencies": {    "express": "6.2.0",    "express-rate-limit": "7.4.0"  }}

Not flagged

package.json · JSON
{  "name": "checkout-api",  "version": "1.0.0",  "private": true,  "dependencies": {    "express": "4.21.2",    "express-rate-limit": "7.4.0"  }}

Why Skylos leaves it alone

Express 4.21.2 exists in the npm registry. For npm, only exact versions are checked: a range such as ^6.2.0 is checked for the package name alone.

How Skylos decides

  1. Reads requirements.txt, pyproject.toml, package.json, go.mod and other manifests up to three folders deep, plus pip install name==1.0, npm install name@1.0 and go get lines in shell scripts, Dockerfiles, .github/workflows files and shell blocks in Markdown.
  2. Takes one version per entry: the == pin, or the lower bound of ~= and >= for Python; the exact version for npm; the required version for Go. Wildcard pins such as ==1.2.* and npm ranges are not checked for a version.
  3. Asks the registry for that version: the PyPI JSON API, the npm registry or the Go module proxy. When the version is missing but the package exists, reports SKY-D225 on the manifest line. When the package is missing too, the finding is SKY-D222 instead.
  4. Skips entries the registry cannot answer (network error, timeout), manifests that use a private index or registry (--index-url, [[tool.poetry.source]], an .npmrc registry, PIP_INDEX_URL=), and ecosystems without a checker, such as Cargo or Maven. Answers are cached in .skylos/cache/dependency_versions.json.

How to fix it

Pin a version the registry really has, normally the newest release of the major version your code was written for. Look it up with pip index versions flask or npm view express versions instead of trusting a suggested number.

Fix · Text
flask==3.1.0gunicorn==23.0.0

When it can be wrong

  • A version published only to your own mirror or private index is reported when the manifest does not name that index. Add the --index-url line or .npmrc registry Skylos can read.
  • A release that the maintainers deleted from the registry is reported as missing, which is usually right: a fresh install fails too.
  • Without network access the registry check cannot answer and nothing is reported.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • [tool.skylos] ignore = ["SKY-D225"] turns the rule off for the project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.