Skip to main content

Overview

Provider errors are thrown by the FrontMCP dependency injection system. They cover unregistered providers, scope mismatches, construction failures, circular dependencies, and plugin dependency issues. All provider errors are internal errors.

Error Reference

ProviderNotRegisteredError

Thrown when a provider token is not found in the registry.
PropertyTypeValue
codestringPROVIDER_NOT_REGISTERED
statusCodenumber500
isPublicbooleanfalse
new ProviderNotRegisteredError(tokenName: string, context?: string)
Example:
import { ProviderNotRegisteredError } from '@frontmcp/sdk';

throw new ProviderNotRegisteredError('DatabaseService', 'ToolRegistry');
// "Provider "DatabaseService" is not registered (ToolRegistry)"

ProviderScopeMismatchError

Thrown when a provider’s scope doesn’t match the registry it’s being resolved in.
PropertyTypeValue
codestringPROVIDER_SCOPE_MISMATCH
statusCodenumber500
isPublicbooleanfalse
new ProviderScopeMismatchError(tokenName: string, scopeName: string, registryName: string)

ProviderNotInstantiatedError

Thrown when a provider is expected to be instantiated but hasn’t been created yet.
PropertyTypeValue
codestringPROVIDER_NOT_INSTANTIATED
statusCodenumber500
isPublicbooleanfalse
new ProviderNotInstantiatedError(tokenName: string, scope?: string, context?: string)

DependencyCycleError

Thrown when a circular dependency is detected in the provider graph.
PropertyTypeValue
codestringDEPENDENCY_CYCLE
statusCodenumber500
isPublicbooleanfalse
new DependencyCycleError(cycle: string)
Example:
import { DependencyCycleError } from '@frontmcp/sdk';

throw new DependencyCycleError('A -> B -> C -> A');
// "Circular dependency detected: A -> B -> C -> A"

ProviderConstructionError

Thrown when constructing a provider instance fails.
PropertyTypeValue
codestringPROVIDER_CONSTRUCTION_FAILED
statusCodenumber500
isPublicbooleanfalse
originalErrorError | undefinedThe underlying cause
new ProviderConstructionError(tokenName: string, cause?: Error | string, qualifier?: string)
Example:
import { ProviderConstructionError } from '@frontmcp/sdk';

throw new ProviderConstructionError('DatabaseService', new Error('Connection refused'));
// "Failed to construct provider "DatabaseService": Connection refused"

ProviderDependencyError

Thrown when a provider dependency cannot be resolved.
PropertyTypeValue
codestringPROVIDER_DEPENDENCY_ERROR
statusCodenumber500
isPublicbooleanfalse
new ProviderDependencyError(message: string)

ProviderScopedAccessError

Thrown when a scoped provider is accessed from the wrong scope.
PropertyTypeValue
codestringPROVIDER_SCOPED_ACCESS
statusCodenumber500
isPublicbooleanfalse
new ProviderScopedAccessError(tokenName: string, scopeName: string)
Example:
import { ProviderScopedAccessError } from '@frontmcp/sdk';

throw new ProviderScopedAccessError('RequestLogger', 'global');
// "Cannot access scoped provider "RequestLogger" from scope "global""

ProviderNotAvailableError

Thrown when a provider is not available in the current context.
PropertyTypeValue
codestringPROVIDER_NOT_AVAILABLE
statusCodenumber500
isPublicbooleanfalse
new ProviderNotAvailableError(tokenName: string, context?: string)

PluginDependencyError

Thrown when a plugin dependency cannot be resolved.
PropertyTypeValue
codestringPLUGIN_DEPENDENCY_ERROR
statusCodenumber500
isPublicbooleanfalse
new PluginDependencyError(message: string)

InvalidDependencyScopeError

Thrown when a dependency has an invalid scope configuration.
PropertyTypeValue
codestringINVALID_DEPENDENCY_SCOPE
statusCodenumber500
isPublicbooleanfalse
new InvalidDependencyScopeError(message: string)

InvalidPluginScopeError

Thrown when a plugin with scope='server' is used in a standalone app, which is not allowed.
PropertyTypeValue
codestringINVALID_PLUGIN_SCOPE
statusCodenumber500
isPublicbooleanfalse
new InvalidPluginScopeError(message: string)