Files
pmg/errcodes/codes.go
T
02965143d0 fix: fail fast when package manager is not installed (#360)
* fix: fail fast with clear error when package manager is not installed

When PMG shims intercept a package manager that isn't installed (e.g. a
clean JAMF-provisioned laptop where PMG is set up before dev tooling),
real-binary resolution failed with a generic "unknown" error and a
bug-report link, making it look like PMG itself had crashed.

Introduce a typed BinaryNotFoundError that exits with code 127 (standard
"command not found") and maps to a new PackageManagerNotFound error code
with an actionable message instead of the Unknown classification.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: improve missing package manager help message

Use a concise, dynamic install hint instead of explaining PMG's
PATH forwarding internals.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: mention PATH in missing package manager help text

Covers the common case where a package manager is installed but its bin
directory is not on PATH yet (e.g. after curl | bash install).

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 18:31:18 +05:30

38 lines
1.5 KiB
Go

package errcodes
const (
InvalidArgument = "InvalidArgument"
PermissionDenied = "PermissionDenied"
NotFound = "NotFound"
Timeout = "Timeout"
Canceled = "Canceled"
UnexpectedEOF = "UnexpectedEOF"
Lifecycle = "Lifecycle"
Network = "Network"
PackageManagerExecutionFailed = "PackageManagerExecutionFailed"
PackageManagerNotFound = "PackageManagerNotFound"
BubblewrapNotFound = "BubblewrapNotFound"
// Package manager error codes.
DependencyResolutionFailed = "DependencyResolutionFailed"
PackageParseFailed = "PackageParseFailed"
PackageAuthorNotFound = "PackageAuthorNotFound"
GitHubRateLimitExceeded = "GitHubRateLimitExceeded"
// Certificate trust store error codes.
CertGeneration = "CertGeneration"
CertPersistence = "CertPersistence"
CertTrustStore = "CertTrustStore"
UnsupportedPlatform = "UnsupportedPlatform"
// Proxy error codes. ProxyPolicyViolation is returned when the proxy blocked
// one or more packages by policy (malware, dependency cooldown, or a denied
// suspicious package) and the run was gated with --fail-on-violation.
ProxyPolicyViolation = "ProxyPolicyViolation"
// Unknown mirrors the default code that dry/usefulerror returns for errors
// created without an explicit code, so unset and explicitly-unknown errors
// classify identically (e.g. the bug-report hint in ui.ErrorExit).
Unknown = "unknown"
)