# AUR0022

### **Error message**

The @inject decorator on the target ('xxxx') type 'yyyy' is not supported.

### **Parameters**

* Target name (string)
* Target type (string)

### Error explanation

This error occurs when the `@inject` decorator is used in a way that is not supported by Aurelia's DI system. For example, applying `@inject` to a field, method, or other unsupported target will trigger this error. The `@inject` decorator is intended for use on classes and, in some cases, constructor parameters.

### Common causes

* Using `@inject` on a field, method, or property instead of a class or constructor parameter.
* Incorrect usage of the decorator in TypeScript or JavaScript code.
* Attempting to use `@inject` in a context not supported by Aurelia's DI system.

### How to fix

* Only use `@inject` on classes or constructor parameters.
* Review the documentation for correct usage of the `@inject` decorator.
* Refactor your code to move dependency injection to supported locations (class or constructor).

### Debugging tips

* Check the stack trace to see where the invalid `@inject` usage occurred.
* Search your codebase for all usages of `@inject` and verify they are on classes or constructors.
* If using plugins, try disabling them one at a time to isolate the source.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aurelia.io/developer-guides/error-messages/0001-to-0023/aur0022.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
