<p dir="auto">Hi this is an error  that for some people must be confusing, when you dont add in a controller using annotations route the correct namespaces like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;"><pre class="notranslate"><code class="notranslate">use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
</code></pre></div>
<p dir="auto">and then you use :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    * @Method({&quot;GET&quot;})"><pre class="notranslate"><code class="notranslate">    * @Method({"GET"})
</code></pre></div>
<p dir="auto">In some anotattion in a controller Symfony throw an Exception that says:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Whoops, looks like something went wrong.
1/1 FileLoaderImportCircularReferenceException in FileLoader.php line 97:
..."><pre class="notranslate"><code class="notranslate">Whoops, looks like something went wrong.
1/1 FileLoaderImportCircularReferenceException in FileLoader.php line 97:
...
</code></pre></div>
<p dir="auto">witch is wrong and confusing, thanks</p>
<p dir="auto">I was struggling to debug why I got a circular reference error trying to add my controller to a new application. The controller below with the config in routing.yml should be able to reproduce this. I found out that the error is triggered by a missing use statement: <code class="notranslate">use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;</code> as I used <code class="notranslate">@Template()</code>. I get the same error if the <code class="notranslate">@Route</code> use statement is missing.</p>
<p dir="auto">This error is very unclear and should be able to get a better message.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FileLoaderImportCircularReferenceException in FileLoader.php line 97:
Circular reference detected in &quot;/home/ivanderberg/projects/login/www/app/config/routing.yml&quot; (&quot;/home/ivanderberg/projects/login/www/app/config/routing.yml&quot; &gt; &quot;/home/ivanderberg/projects/login/www/src/App/Controller&quot; &gt; &quot;/home/ivanderberg/projects/login/www/app/config/routing.yml&quot;)."><pre class="notranslate"><code class="notranslate">FileLoaderImportCircularReferenceException in FileLoader.php line 97:
Circular reference detected in "/home/ivanderberg/projects/login/www/app/config/routing.yml" ("/home/ivanderberg/projects/login/www/app/config/routing.yml" &gt; "/home/ivanderberg/projects/login/www/src/App/Controller" &gt; "/home/ivanderberg/projects/login/www/app/config/routing.yml").
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// routing.yml
app:
    resource: &quot;@App/Controller&quot;
    type:     annotation
    prefix:   /"><pre class="notranslate"><code class="notranslate">// routing.yml
app:
    resource: "@App/Controller"
    type:     annotation
    prefix:   /
</code></pre></div>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;?php
namespace App\Controller\Auth;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

/**
 * @Route(service=&quot;app.controller.auth.login&quot;)
 */
class LoginController
{
    /**
     * @Route(&quot;/&quot;, name=&quot;app.auth.login&quot;)
     * @Template()
     */
    public function loginAction()
    {
        return [];
    }
}
"><pre class="notranslate"><span class="pl-ent">&lt;?php</span>
<span class="pl-k">namespace</span> <span class="pl-v">App</span>\<span class="pl-v">Controller</span>\<span class="pl-v">Auth</span>;

<span class="pl-k">use</span> <span class="pl-v">Sensio</span>\<span class="pl-v">Bundle</span>\<span class="pl-v">FrameworkExtraBundle</span>\<span class="pl-v">Configuration</span>\<span class="pl-v">Route</span>;

<span class="pl-c">/**</span>
<span class="pl-c"> * @Route(service="app.controller.auth.login")</span>
<span class="pl-c"> */</span>
<span class="pl-k">class</span> <span class="pl-v">LoginController</span>
{
    <span class="pl-c">/**</span>
<span class="pl-c">     * @Route("/", name="app.auth.login")</span>
<span class="pl-c">     * @Template()</span>
<span class="pl-c">     */</span>
    <span class="pl-k">public</span> <span class="pl-k">function</span> <span class="pl-en">loginAction</span>()
    {
        <span class="pl-k">return</span> [];
    }
}</pre></div>