Mysterious 404 /undefined

I built my personal website using Grav ( and I have a mysterious console error on every page: a request for ‘’ I don’t understand what exactly is causing this 404.

The console says the request is made on line 1 which is weird as line 1 is obviously my doctype html.
Here is the details:

Request 17:
Error/Status Code: 404
Initiated By: line 1
Client Port: 2290
Request Start: 1.536 s
Time to First Byte: 1858 ms
Content Download: 15 ms
Bytes In (downloaded): 3.9 KB
Bytes Out (uploaded): 0.6 KB
Request Headers:
GET /undefined HTTP/1.1
Connection: keep-alive
Accept: image/webp,image/*,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36 PTST/201
Accept-Encoding: gzip, deflate, sdch
Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: __cfduid=da550b45a3f7f4129f7ecc5ae63f4517f1463834633; 300gpBAK=R4178755467; 300gp=R393486697; grav-site-6adfb31=e0ca64f91b8010587add0cfd79c5e252; grav-site-6adfb31=e0ca64f91b8010587add0cfd79c5e252; _ga=GA1.2.33581958.1463834674; _gat=1
Response Headers:

HTTP/1.1 404 Not Found
Date: Sat, 21 May 2016 12:43:57 GMT
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: 300gp=R393486697; path=/; expires=Sat, 21-May-2016 13:45:11 GMT
X-Powered-By: PHP/5.6.21
Pragma: no-cache
Set-Cookie: grav-site-6adfb31=e0ca64f91b8010587add0cfd79c5e252; expires=Sat, 21-May-2016 13:13:55 GMT; Max-Age=1800; path=/;; httponly
Cache-Control: max-age=604800
Expires: Sat, 28 May 2016 12:43:57 GMT
Vary: Accept-Encoding
Server: cloudflare-nginx
CF-RAY: 2a681de61e431037-CDG
Content-Encoding: gzip

I’m not sure it is related to Grav but I hope somebody can help!

Many thanks in advance!

It appears something is being included which does not exist, thus it redirects to an undefined source. Have you checked that all asset-references are ok?

firefox has found this in line 7, I hope you have help … Schermata del 2016-05-21 18:54:04

That explains it, the background-image set for .main-header is not correctly parsed by Twig. How are you setting this variable?

Excellent! Thanks a lot! I had a script that called for a background image, and it was set to output undefined if the file was not found. Solved! Thanks!