Assetic - Route "_assetic_001d5b7_0" does not exist
Asked Answered
B

9

22

This question seems to have been asked multiple times but none of the solutions work for me.

I'm in my prod environment, here is what I've done:

  • cleared cache before/after doing anything
  • attempted commenting out the _assetic stuff in config_dev and ensure it isn't anywhere else (not that this should matter in prod env)
  • set use_controller to both true and false (obviously works with true but doesn't use the compiled files)

Is there anything else I'm missing? The files are generating completely fine from php app/console assetic:dump --env=prod --no-debug the file name matches that of in the error minus the route stuff.

Bonniebonns answered 13/7, 2012 at 0:42 Comment(7)
Have you set the bundles: [MyBundle, MyOtherBundle] option in config.yml? What versions of Assetic and AsseticBundle are you using?Sporule
Thanks for the reply. Nope, haven't set that, what does it achieve?Bonniebonns
Assetic will only search for assets in the bundles specified in bundles[].Sporule
My app is almost entirely client side, all my assets are linked in app/resources/views/base.html.twig, should I add the bundles parameters without any bundles listed?Bonniebonns
I don't get why it is even trying to load a route in production mode. shouldn't it be trying to load the static file?Bonniebonns
Although this question claims that it has been asked before, the question suggested as a duplicate is not a duplicate as this error happens in use_controller=true mode, the linked question is about use_controller=falseSarilda
do you use APC cache? If you do, clear it :)Futile
C
50

I had this problem just one minute ago. Clean up the cache worked for me:

app/console cache:clear --env=prod

Hope this helps.

Choochoo answered 13/8, 2012 at 11:57 Comment(3)
Nope, doesn't work, that was the first thing I tried. Thanks for the answer though, I couldn't solve it so i stopped using assetic and set up a grunt script to compile all my files.Bonniebonns
IME basic "rm -rf app/cache" seems to be more reliable than the cache:clear or ot:cc app/console commands for some reason.Elvyn
@Marcus, thanks I have deleted the cache several times using console commands and the problem persisted, "rm -rf" did the trick!!!Heisler
V
22

If clearing the cache or dumping the assets doesn't work. Try noisebleed's comment:

// app/config_dev.yml
assetic:
    use_controller: true
    bundles: ['FooBarBundle']
Villainous answered 30/9, 2013 at 17:57 Comment(1)
I had this problem and it was from not including a my bundle in the bundles array.Euchre
A
14

Maybe you have removed the assetic routing from the app/routing_dev.yml

_assetic:
    resource: .
    type:     assetic
Agadir answered 20/11, 2013 at 16:19 Comment(1)
I can't believe it's not mentioned in the doc symfony.com/doc/current/assetic/asset_management.htmlModeration
I
2

Faced with the same issue but reason was I name template as "something.twig", not "something.html.twig".

Its seems assetic not scan templates without .html in extension.

As result - template work, but assetic not perform dumping/adding routes for assets from it. Adding .html solve the problem.

Intone answered 23/3, 2016 at 13:56 Comment(0)
P
1

Updating the config.yml with a dumb character (newline, white space) remove that error. It seems that by doing that, we force the cache do be re-generated. (Symfony 3.0.0)

Pincers answered 27/1, 2016 at 9:13 Comment(0)
S
0

maybe is too late but... what worked for me:

php composer.phar install
php app/console cache:clear
php app/console cache:warmup
Sadesadella answered 17/9, 2014 at 19:15 Comment(0)
B
0

Like @Marcus said, if you tried:

php bin/console cache:clear

and it didn't help, please clear the your_project_root/var/cache folder manually (remove all folders and files). If you use unix/linux systems, and receive a system message like "Error removing file: Permission denied", you need to change accesses to dir first, for example you can use console command

sudo chmod -R 0777 /your_site_directory/var/cache/

and after this you can clear cache dir.

Bajaj answered 11/10, 2016 at 15:0 Comment(0)
O
0

I encountered this issue in Symfony 3.3 after trying to override my Twig templates directory. Not sure how to fix the issue, but reverting to default templates directory config resolved the issue for now.

# config.yml
twig:
    paths: ["%kernel.project_dir%/templates"] # Remove this line to use default dir
Orlosky answered 30/1, 2018 at 21:16 Comment(0)
S
0

After trying all the suggested solutions here, to me it was simply the issue with the name of the template. I had .twig but not .html.twig extension, that's all.

Swivel answered 4/3, 2020 at 19:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.