gatsbyjs/gatsby · error

Could not get web socket

Error message

Could not get web socket

What it means

Development-runtime diagnostic: the dev-loader's websocket helper received a falsy socket (socket.io connection could not be established to the dev server). Hot updates, query results and error overlays will not be pushed; the loader logs this warning once during construction and pages fall back to full reloads/no updates.

Source

Thrown at packages/gatsby/cache-dir/dev-loader.js:70

    this.notFoundPagePathsInCaches = new Set()

    if (socket) {
      socket.on(`message`, msg => {
        if (msg.type === `staticQueryResult`) {
          this.handleStaticQueryResultHotUpdate(msg)
        } else if (msg.type === `pageQueryResult`) {
          this.handlePageQueryResultHotUpdate(msg)
        } else if (msg.type === `sliceQueryResult`) {
          this.handleSliceQueryResultHotUpdate(msg)
        } else if (msg.type === `stalePageData`) {
          this.handleStalePageDataMessage(msg)
        } else if (msg.type === `staleServerData`) {
          this.handleStaleServerDataMessage(msg)
        }
      })
    } else if (process.env.NODE_ENV !== `test`) {
      console.warn(`Could not get web socket`)
    }
  }

  updateAsyncRequires(asyncRequires) {
    this.asyncRequires = asyncRequires
  }

  loadPage(pagePath) {
    const realPath = findPath(pagePath)
    return super.loadPage(realPath).then(result => {
      if (this.isPageNotFound(realPath)) {
        this.notFoundPagePathsInCaches.add(realPath)
      }

      return result
    })
  }

View on GitHub (pinned to e85d62f177)

Solutions

  1. Confirm `gatsby develop` is still running and the port/host match the page URL
  2. Check for proxies, firewalls or custom devServer config (https, allowedHosts) blocking the websocket upgrade
  3. Disable ad-blockers/browser extensions that can kill websocket connections
  4. Restart the dev server and hard-reload the page
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/gatsby/cache-dir/dev-loader.js:70 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/add8d119743b1c2d. Report an issue: GitHub.