Skip to main content
Error classes thrown during ESM package loading. Import them from @frontmcp/sdk:
import {
  EsmPackageLoadError,
  EsmVersionResolutionError,
  EsmManifestInvalidError,
  EsmCacheError,
  EsmRegistryAuthError,
  EsmInvalidSpecifierError,
} from '@frontmcp/sdk';

Overview

ErrorBase ClassError CodeHTTPDescription
EsmPackageLoadErrorInternalMcpErrorESM_PACKAGE_LOAD_ERROR500Bundle fetch or module evaluation failed
EsmVersionResolutionErrorInternalMcpErrorESM_VERSION_RESOLUTION_ERROR500npm registry version resolution failed
EsmManifestInvalidErrorPublicMcpError-32602 (INVALID_PARAMS)400Package manifest is invalid or missing required fields
EsmCacheErrorInternalMcpErrorESM_CACHE_ERROR500Cache read/write operation failed
EsmRegistryAuthErrorPublicMcpError-32001 (UNAUTHORIZED)401Private registry authentication failed
EsmInvalidSpecifierErrorPublicMcpError-32602 (INVALID_PARAMS)400Package specifier string is malformed

EsmPackageLoadError

Thrown when loading an ESM package fails — including network errors, CDN timeouts, and module evaluation failures.
class EsmPackageLoadError extends InternalMcpError {
  readonly packageName: string;
  readonly version?: string;
  readonly originalError?: Error;
}
PropertyTypeDescription
packageNamestringFull package name (e.g., @acme/tools)
versionstring?Resolved version that failed to load
originalErrorError?Underlying fetch or evaluation error

EsmVersionResolutionError

Thrown when the npm registry cannot resolve a version for the given semver range — including network errors, 404s, and no matching version.
class EsmVersionResolutionError extends InternalMcpError {
  readonly packageName: string;
  readonly range: string;
  readonly originalError?: Error;
}
PropertyTypeDescription
packageNamestringFull package name
rangestringSemver range that failed to resolve (e.g., ^3.0.0)
originalErrorError?Underlying registry error

EsmManifestInvalidError

Thrown when a package’s default export does not conform to the FrontMcpPackageManifest contract — missing name, version, or invalid primitive arrays.
class EsmManifestInvalidError extends PublicMcpError {
  readonly packageName: string;
  readonly details?: string;
  readonly mcpErrorCode = -32602; // INVALID_PARAMS
}
PropertyTypeDescription
packageNamestringFull package name
detailsstring?Zod validation error details

EsmCacheError

Thrown when a cache operation (read, write, cleanup) fails — typically due to file system permission issues or disk space.
class EsmCacheError extends InternalMcpError {
  readonly operation: string;
  readonly packageName?: string;
  readonly originalError?: Error;
}
PropertyTypeDescription
operationstringCache operation that failed (e.g., 'get', 'put', 'cleanup')
packageNamestring?Package involved in the operation
originalErrorError?Underlying I/O error

EsmRegistryAuthError

Thrown when authentication to a private npm registry fails — invalid token, expired credentials, or wrong registry URL.
class EsmRegistryAuthError extends PublicMcpError {
  readonly registryUrl?: string;
  readonly details?: string;
  readonly mcpErrorCode = -32001; // UNAUTHORIZED
}
PropertyTypeDescription
registryUrlstring?Registry URL that rejected authentication
detailsstring?Additional error details

EsmInvalidSpecifierError

Thrown when a package specifier string is malformed — does not match the expected @scope/name@range or name@range pattern.
class EsmInvalidSpecifierError extends PublicMcpError {
  readonly specifier: string;
  readonly mcpErrorCode = -32602; // INVALID_PARAMS
}
PropertyTypeDescription
specifierstringThe invalid specifier string