Skip to content

fix: skip invalid dependency names and versions - #431

Merged
favoyang merged 2 commits into
masterfrom
fix/skip-invalid-dependency-versions
Nov 2, 2026
Merged

favoyang merged 2 commits into
masterfrom
fix/skip-invalid-dependency-versions

Conversation

@favoyang

@favoyang favoyang commented Nov 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Validate dependency names and versions from registry packuments before adding them to the dependency graph.
  • Warn and skip invalid entries instead of crashing with an unclassified AssertionError from makePackageSpec.
  • Match the Unity Package Manager behavior: Unity validates dependency entries, logs a warning, and skips invalid ones.
  • Print the stack and causes of unrecognized errors in --verbose mode so future CLI failures are diagnosable.

Why

A published package declares "com.unity.ugui": "1.0.0~", which is not a valid semantic version. openupm add and openupm deps --deep failed with A fatal error occurred. even though Unity installs the package normally. See openupm/openupm#7149.

Behavior changes

  • An invalid dependency name or version now produces a warning, the entry is skipped, and the remaining dependencies are still resolved.
  • add and deps --deep succeed for the reported package.
  • Dependency versions must be exact semantic versions. Tag values such as latest or stable, and URL values, in a package's dependencies are skipped with a warning, matching Unity.
  • Known error messages are unchanged. Unrecognized errors keep the generic message in normal output and include the stack and causes with --verbose.

Validation

  • npm run build
  • npm run test:unit
  • npm run test:integration
  • Manual check against the public OpenUPM registry with the reported package: add and deps --deep succeed and emit one warning.

Registry packuments can declare dependency names or versions that do not follow the Unity package rules. Unity's Package Manager validates these entries, logs a warning, and skips them. openupm-cli instead crashed with an unclassified assertion when building package specs and dependency graphs.

Validate dependency names and versions while resolving a packument version, warn for each invalid entry, and keep resolving the remaining dependencies. This fixes both 'add' and 'deps --deep' for packages such as com.github.kou-yeung.webglinput, which declares com.unity.ugui@1.0.0~.

Dependency versions must now be exact semantic versions, so tag values such as 'latest' or 'stable' in a package's dependencies are skipped with a warning, matching Unity's behavior.
Errors without a specific message were reduced to 'A fatal error occurred.' even with --verbose, which made CLI failures hard to diagnose. Print the error stack and its causes in verbose mode, while keeping the generic message for normal output.
@favoyang
favoyang merged commit 7dc8147 into master Nov 2, 2026
10 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 2, 2026
## [4.5.3](4.5.2...4.5.3) (2026-11-02)

### Bug Fixes

* skip invalid dependency names and versions ([#431](#431)) ([7dc8147](7dc8147))
@favoyang
favoyang deleted the fix/skip-invalid-dependency-versions branch November 2, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant