# AUR9996

## Error Message

`AUR9996: Invalid usage, a rate limit has already been applied. Did you have both throttle and debounce on the same binding?`

## Description

This error occurs when you attempt to apply more than one rate-limiting binding behavior (`throttle` or `debounce`) to the same binding expression. Aurelia's binding system allows only one of these behaviors per binding.

## Cause

The direct cause is using both `& throttle` and `& debounce` on the same binding expression in your template.

* **Example:** `<input value.bind="searchTerm & throttle:500 & debounce:1000">`

## Solution

Choose only *one* rate-limiting strategy for the binding:

1. **Select `throttle` OR `debounce`:** Decide whether you need `throttle` (limits execution frequency to at most once per specified interval) or `debounce` (delays execution until a specified period of inactivity has passed). Remove the behavior you don't need.
2. **Refactor Logic:** If you have a complex scenario where you feel both might be needed, reconsider the approach. Perhaps the logic can be handled within the view model, potentially using separate triggers or more sophisticated event handling (e.g., using RxJS if already part of your project).

## Example

```html
<!-- Incorrect: Applying both throttle and debounce -->
<input type="text" value.bind="searchText & throttle:300 & debounce:500">

<!-- Correct: Using only throttle -->
<input type="text" value.bind="searchText & throttle:300">

<!-- Correct: Using only debounce -->
<input type="text" value.bind="searchText & debounce:500">
```

```typescript
// View Model
import { customElement } from 'aurelia';

@customElement({ /* ... */ })
export class SearchComponent {
  searchText: string = '';

  // The view model logic remains the same,
  // the choice between throttle/debounce is in the template.
  searchTextChanged(newValue: string, oldValue: string) {
    console.log(`Search text changed to: ${newValue}`);
    // Perform search logic here
  }
}
```

## Debugging Tips

* Inspect the binding expression in your template identified by the error or stack trace.
* Look for the presence of both `& throttle` and `& debounce` within that single expression.
* Remove one of the binding behaviors (`throttle` or `debounce`) to resolve the error.


---

# 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/aur9996.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.
