---
url: https://masyaka.github.io/injecute/errors/invalid-factory.md
description: The factory is not a function or class
---

# `INJECUTE_INVALID_FACTORY`

**The factory is not a function or class.**

## How to fix it

Pass a function that creates the service, a class, or use addInstance() for a ready value.

## Handling it in code

```ts
import { InjecuteError } from 'injecute';

try {
  // ...
} catch (error) {
  if (error instanceof InjecuteError && error.code === 'INJECUTE_INVALID_FACTORY') {
    // error.message explains what happened; error.path is the resolution chain
  }
}
```

[All error codes](./index.md)
