# AUR0756

## Error Message

`AUR0756: Cannot resolve ViewFactory without a (valid) name.`

## Description

This internal error occurs when Aurelia's rendering engine attempts to retrieve a `ViewFactory` (used to create view instances) but lacks a valid identifier for the component whose `ViewFactory` is needed. The identifier is typically the component's definition object or its registered resource name.

## Cause

Similar to AUR0755, this error is generally not caused directly by standard application code. It points to an issue within the rendering pipeline or resource management. Possible scenarios include:

1. **Corrupted Component Definition:** A component's definition might be missing, incomplete, or corrupted internally before the `ViewFactory` is requested. This could potentially happen due to complex interactions or bugs.
2. **Incorrect Dynamic Composition:** Issues in how components are dynamically composed (e.g., using `<au-compose>`) might lead to situations where a component's definition is not correctly passed or resolved. For example, providing `null`, `undefined`, or an invalid value to the `component` bindable of `<au-compose>`.
3. **Manual Internal API Use:** Improper interaction with internal Aurelia APIs related to resource resolution or rendering could lead to this state.
4. **Potential Bug in Aurelia:** This could indicate an underlying bug in how Aurelia handles component definitions or resolves resources internally.

## Solution

Focus on standard practices and identifying the source of the invalid definition:

1. **Check Dynamic Composition:** If using `<au-compose>`, ensure the value bound to the `component` attribute is always a valid component definition (the imported class), its registered name (string), or a `Promise` resolving to one. Avoid passing `null`, `undefined`, or other invalid types. Add checks or defaults if necessary.

   ```html
   <!-- Ensure 'myDynamicComponent' resolves to a valid component or name -->
   <au-compose component.bind="myDynamicComponent || DefaultComponent"></au-compose>
   ```
2. **Verify Component Definitions:** Ensure all custom elements and attributes are correctly defined with `@customElement` or `@customAttribute` decorators and have valid names.
3. **Avoid Internal API Manipulation:** Stick to public, documented Aurelia APIs.
4. **Update Aurelia Packages:** Keep Aurelia packages updated to benefit from bug fixes.
5. **Isolate and Reproduce:** Try to find the specific scenario or component causing the error. Create a minimal reproduction case. This helps determine if it's related to specific application logic (like dynamic composition) or a framework issue.
6. **Report the Issue:** If a framework bug is suspected, report it with a clear reproduction on the Aurelia GitHub repository.

## Debugging Tips

* Examine the call stack in the debugger when the error occurs to see the context in which `getViewFactory` was called without a valid name/definition.
* If using `<au-compose>`, log the value being passed to the `component` attribute just before it's used.
* Simplify the template and view model of the suspected component to isolate the part triggering the error.
