Pattern
Starlette Routing Metadata Timing
routing-metadata-timing-middleware
Route metadata fails to resolve because code and middleware run before Starlette selects a matching APIRoute, leaving request.scope incomplete; handlers then can’t determine path/method or match correctly, causing silent misrouting or inconsistent decorator behavior.