# Axum error "the trait bound Handler<_, _> is not satisfied". How do I find the cause?
Source: https://ruststudio.org/community/t/167/axum-error-the-trait-bound-handler-is-not-satisfied-how-do-i-find-the-cause
Author: Ruststudio Team (staff) | Published: 2026-12-05 | Updated: 2026-12-05 | Checked with: rustc 1.93.0, axum 0.8.9 with the macros feature, tokio 1.54.1, Windows 11; errors pasted from cargo check
Category: Help and questions | Kind: Troubleshooting | Tags: axum, compile-errors, debug-handler, troubleshooting | Views: 0

## Short answer
The compiler says a function is not a Handler without saying why. Add #[axum::debug_handler] above the function and compile again: the macro checks each requirement separately and reports the real cause, for example a value that is not Send being held across an await.

## Answer
## Symptom
`Router::route("/", get(handler))` fails to compile:

```text
error[E0277]: the trait bound `fn() -> impl Future<Output = String> {handler}: Handler<_, _>` is not satisfied
   --> examples\f11.rs:12:53
    |
 12 |     let _app: Router = Router::new().route("/", get(handler));
    |                                                 --- ^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn() -> impl Future<Output = String> {handler}`
    |                                                 |
    |                                                 required by a bound introduced by this call
    |
    = note: Consider using `#[axum::debug_handler]` to improve the error message
...
```

## Cause
A handler is any async function whose arguments are extractors and whose result converts into a response, **and** whose future can be sent between threads. When one requirement fails, the compiler can only say that the whole `Handler` trait is not implemented. This handler keeps an `Rc` (which is not `Send`) alive across an `.await`:

```rust title=examples/f11.rs
use axum::{routing::get, Router};
use std::rc::Rc;

async fn handler() -> String {
    let counter = Rc::new(5);
    tokio::time::sleep(std::time::Duration::from_millis(1)).await;
    format!("{counter}")
}

#[tokio::main]
async fn main() {
    let _app: Router = Router::new().route("/", get(handler));
}
```

## Fix
Enable the `macros` feature (`axum = { version = "0.8.9", features = ["macros"] }`) and add `#[debug_handler]` above the function. It checks the pieces one by one:

```rust title=examples/f11b.rs
use axum::{debug_handler, routing::get, Router};
use std::rc::Rc;

#[debug_handler]
async fn handler() -> String {
    let counter = Rc::new(5);
    tokio::time::sleep(std::time::Duration::from_millis(1)).await;
    format!("{counter}")
}

#[tokio::main]
async fn main() {
    let _app: Router = Router::new().route("/", get(handler));
}
```

The error now names the cause:

```text
error: future cannot be sent between threads safely
 --> examples\f11b.rs:4:1
  |
4 | #[debug_handler]
  | ^^^^^^^^^^^^^^^^ future returned by `handler` is not `Send`
  |
  = help: within `impl Future<Output = String>`, the trait `Send` is not implemented for `Rc<i32>`
note: future is not `Send` as this value is used across an await
 --> examples\f11b.rs:7:61
  |
6 |     let counter = Rc::new(5);
  |         ------- has type `Rc<i32>` which is not `Send`
7 |     tokio::time::sleep(std::time::Duration::from_millis(1)).await;
  |                                                             ^^^^^ await occurs here, with `counter` maybe used later
note: required by a bound in `__axum_macros_check_handler_future::check`
 --> examples\f11b.rs:4:1
  |
4 | #[debug_handler]
  | ^^^^^^^^^^^^^^^^ required by this bound in `check`
...
```

Replace `Rc` with `Arc`, or end the value's life before the `.await` by putting it in a smaller block. Remove `#[debug_handler]` afterwards if you like: it only improves messages.

## Common mistakes
- Holding a `std::sync::MutexGuard` over an `.await`. It is not `Send` either, and the macro reports it the same way.

## Related questions
### Why must the handler's future be Send?
The runtime may move a request's task from one worker thread to another between awaits, so everything alive across an await must be safe to move.

## Sources
- axum, `debug_handler`: https://docs.rs/axum/0.8.9/axum/attr.debug_handler.html (read 2026-12-05)
- Tokio tutorial, shared state (holding locks across awaits): https://tokio.rs/tokio/tutorial/shared-state (read 2026-12-05)
