# AUR0762

## Error Message

`AUR0762: Trying to retrieve a custom element controller from a node, but the provided node <{{nodeName}} /> is not a custom element or containerless host.`

Where `{{nodeName}}` is the tag name (or `#comment` for comment nodes) of the provided DOM node.

## Description

This error occurs when calling `CustomElement.for(node)` (or an API that uses it) with a DOM node that is not the host element (or containerless marker) of an Aurelia custom element instance.

## Example Trigger

```ts
import { CustomElement } from '@aurelia/runtime-html';

// ❌ Passing a normal element instead of a custom element host
const div = document.querySelector('div')!;
CustomElement.for(div); // throws AUR0762
```

## Correct Usage

* Pass the actual host element of the custom element instance (for example the `<my-component>` element).
* For containerless custom elements, the host is a comment marker node; prefer alternative access patterns (DI, parent/child relationships) rather than trying to locate the marker manually.

## Troubleshooting

* Verify you are not passing a node inside a component’s template (use the component host instead).
* Ensure the node is part of the Aurelia-managed DOM tree for the app instance you are querying.
* If you are calling this too early, wait until `attached()` (or after composition completes).

## Related Errors

* [AUR0763](/developer-guides/error-messages/runtime-html/aur0763.md)
* [AUR0764](/developer-guides/error-messages/runtime-html/aur0764.md)
* [AUR0765](/developer-guides/error-messages/runtime-html/aur0765.md)


---

# 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/runtime-html/aur0762.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.
