AUR0017

Failed to instantiate 'xxxx' via @newInstanceOf/@newInstanceForScope, there's no registration and no default implementation, or the default implementation does not result in factory for constructing t

Error message

Failed to instantiate 'xxxx' via @newInstanceOf/@newInstanceForScope, there's no registration and no default implementation, or the default implementation does not result in factory for constructing the instances.

Parameters

Interface key (string)

Error explanation

This error occurs when you attempt to instantiate an interface using @newInstanceOf or @newInstanceForScope, but there is no registration for the interface, no default implementation, or the default implementation does not provide a factory for constructing instances. The DI system cannot create a new instance without a valid registration or factory.

Common causes

  • The interface was not registered with a concrete implementation.

  • The default implementation for the interface does not provide a factory.

  • There is a typo or mismatch in the interface key used for registration and resolution.

  • A plugin or library expected to register the interface did not do so.

How to fix

  • Register the interface with a concrete implementation using the DI container.

  • Ensure the default implementation provides a factory for constructing instances.

  • Double-check that the interface key used for registration matches the key used for resolution.

  • If using plugins or libraries, ensure they are properly configured and registered.

Debugging tips

  • Check the stack trace to see where the instantiation was attempted.

  • Search your codebase for all registrations and resolutions of the interface key in question.

  • If using plugins, try disabling them one at a time to isolate the source.

Last updated

Was this helpful?