gatsby: Error loading a result for the page query in "/404.html". Query was not run and Page not found /404.html
Description
When using gatsby develop
with a theme, the following error is printed in the terminal after a page is loaded in the browser:
Error loading a result for the page query in "/404.html". Query was not run and
Page not found /404.html
Steps to reproduce
gatsby new my-blog gatsbyjs/gatsby-starter-blog-theme
cd my-blog
gatsby develop
- browse to
http://localhost:8000
- check the terminal to see this message:
Error loading a result for the page query in "/404.html". Query was not run and no cached result was
Page not found /404.html
- This message will be printed to the terminal every time the page is refreshed.
There’s also a repro available at https://github.com/polishedwp/gatsby-starter-theme-eclectic courtesy of @polishedwp
Expected result
The Error loading a result for the page query… message should not appear in the terminal.
Actual result
The message appears.
Environment
System:
OS: macOS 10.14.5
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Languages:
Python: 3.5.3 - /Users/mike/.pyenv/shims/python
Browsers:
Chrome: 75.0.3770.100
Firefox: 67.0.4
Safari: 12.1.1
npmPackages:
gatsby: ^2.13.21 => 2.13.21
gatsby-theme-blog: ^1.0.0 => 1.0.0
npmGlobalPackages:
gatsby-cli: 2.7.7
gatsby-dev-cli: 2.4.19
gatsby: 2.8.8
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 23 (9 by maintainers)
Commits related to this issue
- Ensure `.cache/` is cleared before running `gatsby build` This this might be a workaround for a bug in Gatsby: https://github.com/gatsbyjs/gatsby/issues/15724 — committed to apilcs/website by simonwiles 5 years ago
- Ensure `.cache/` is cleared before running `gatsby build` This this might be a workaround for a bug in Gatsby: https://github.com/gatsbyjs/gatsby/issues/15724 — committed to apilcs/website by simonwiles 5 years ago
I’m also getting this (or a very similar) error on
gatsby build
independently of themes:Running
rm -r .cache
solves the problem until the next build.For me the error persists. Running
gatsby build
still crashes withAs mentioned above, if I delete the cache,
rm -r .cache
, it builds fine but only once.Hey peepz, don’t know if that helps someone, but I had the same
Error loading a result for the page query in "/404.html"
, And that’s with Gatsby v4. My solution was to rungatsby clean
and then to rungatsby build
again.Though everything works as it should, I’m getting the same error when navigating pages I’m routing with
@reach/router
andgatsby-plugin-create-client-paths
My console:gatsby-config.js:
My
pages/authentication/index.js
component:my problem is not solve in running
gatsby clean
. I am using"gatsby": "^4.11.2",
Same issue with client-only paths (‘/app/*’) using gatsby-plugin-create-client-paths@2.1.3
Note that running
gatsby build && gatsby serve
will show the same error aserror Error: ENOENT: no such file or directory, stat '/path/to/my/project/hello-world/public/404.html'
hit the same issue here… anyone has a solution?
Not sure if anyone is still monitoring this thread, but I am occasionally getting this same (similar, but different) error.
As others have said, stopping
gatsby develop
and thenrm -rf .cache
fixes, but about every 3rd or 4th time of runninggatsby develop
I get this error, and if I don’t catch it, it breaks production build pipelines…Did anyone ever find a (more perm) solution for this situation?
edit nvm, I see that this issue is closed (after I posted), I’ll see if I can find a more active/recent ticket).