Skip to content
Musher Docs

Errors and Troubleshooting

Both SDKs use a structured exception hierarchy rooted at MusherError. All SDK exceptions can be caught with a single base class, or you can handle specific error types for finer control.

Exception Hierarchy

ExceptionWhen it's raised
MusherErrorBase class for all SDK exceptions
AuthenticationErrorNo valid credential found, or the token was rejected by the registry
BundleNotFoundErrorThe bundle namespace/slug does not exist in the registry
VersionNotFoundErrorThe bundle exists, but no version matches the requested reference
IntegrityErrorSHA-256 checksum mismatch during pull (includes .expected and .actual hashes)
RegistryErrorThe registry returned an unexpected error
CacheErrorFailed to read or write the local cache
RateLimitErrorToo many requests — retry after the indicated delay
APIErrorGeneral API error with RFC 9457 Problem Details fields

Catching Errors

python
import musher
from musher import (
    AuthenticationError,
    BundleNotFoundError,
    IntegrityError,
    MusherError,
)

try:
    bundle = musher.pull("acme/code-review-kit")
except AuthenticationError:
    print("No valid API key found. Set MUSHER_API_KEY or run 'musher auth login'.")
except BundleNotFoundError:
    print("Bundle not found. Check the namespace and slug.")
except IntegrityError as e:
    print(f"Checksum mismatch: expected {e.expected}, got {e.actual}")
except MusherError as e:
    print(f"SDK error: {e}")

Common Scenarios

Authentication failures

If you see AuthenticationError, the SDK could not find a valid credential from any source. Check that:

  • MUSHER_API_KEY is set in your environment
  • The key starts with mush_ and has not been revoked
  • You have run musher auth login if relying on the keyring

Version resolution failures

In Python, VersionNotFoundError means the bundle exists but no published version matches your reference. In TypeScript, this surfaces as NotFoundError. Verify you are using a valid version constraint:

python
# Exact version
bundle = musher.pull("acme/code-review-kit:1.2.3")

# Semver range
bundle = musher.pull("acme/code-review-kit:^1.0")

# Latest
bundle = musher.pull("acme/code-review-kit")

Integrity failures

IntegrityError indicates that a downloaded asset's SHA-256 checksum does not match the manifest. This can happen if:

  • The local cache is corrupted — clear it and retry
  • A network issue caused a partial download
  • The registry content was tampered with

Rate limiting

RateLimitError is raised when you exceed the registry's request limit. Both SDKs automatically retry with backoff. If you still hit limits, reduce request frequency or contact support.