# AUR9995

## Error Message

`AUR9995: The binding already has a target subscriber.`

## Description

This is an internal error indicating that Aurelia's binding system attempted to establish a connection (subscribe) between a binding instance and its target observer (the mechanism that updates the DOM when the view model changes), but such a connection was already in place for that binding instance.

Each binding should only have one primary subscriber managing the flow of data from the view model to the view target.

## Cause

This error typically signifies an unexpected internal state within the binding system and should not occur during normal application development. Potential, though rare, causes might include:

1. **Internal Race Condition:** An unlikely race condition during the binding setup phase, potentially in highly complex or asynchronous scenarios.
2. **Manual Binding Manipulation (Advanced):** Incorrectly interacting with the internal APIs of a `PropertyBinding` instance manually, such as calling internal lifecycle methods like `useTargetSubscriber` inappropriately.
3. **Memory Leaks or Incorrect Cleanup:** If previous instances of bindings or observers were not cleaned up correctly, it might lead to inconsistent states, although this is speculative.

## Solution

As this points to an internal issue, solutions involve ensuring standard practices and simplifying potential triggers:

1. **Review Advanced Scenarios:** If you are manually creating components, manipulating renderers, or interacting deeply with Aurelia's internal APIs, review that code carefully for correct usage of binding lifecycles.
2. **Simplify Component:** If the error occurs in a specific component, try simplifying its template and logic to isolate the cause. Pay attention to complex bindings, repeaters, conditional rendering, and asynchronous operations.
3. **Check for External Interference:** Ensure no external scripts are manipulating the DOM or Aurelia internals in unexpected ways.
4. **Report Issue:** If you consistently encounter this error in scenarios that seem like standard usage, it could indicate a bug in the framework. Report it to the Aurelia team with a reproducible example.

## Example

This error is not typically triggered by specific template syntax but by internal state issues. A standard binding like this should not cause it:

```html
<input value.bind="userName">
<p>${userMessage}</p>
```

The error would occur if, during the internal setup of the `value.bind="userName"` binding, the `useTargetSubscriber` method was somehow called twice or when the connection was already established.

## Debugging Tips

* This error is difficult to debug from application code due to its internal nature.
* Use browser developer tools to set breakpoints within Aurelia's internal binding files (like `property-binding.ts`) if you suspect a specific area, but this requires familiarity with the framework internals.
* Focus on simplifying the component where the error occurs. Comment out bindings one by one to see if a particular binding is related to the issue.
* Look for patterns: Does it happen only during initial load? Only after certain actions? Only in specific browsers? This information is valuable if reporting a bug.
