gatsbyjs/gatsby · critical

Missing required params

Error message

Missing required params

What it means

The startWebpackServer function requires three params from the build context: program, app (the Express app), and store (the Redux store). If any is missing, the dev server cannot be started. The guard panics immediately with a generic message.

Source

Thrown at packages/gatsby/src/services/start-webpack-server.ts:35

import { IBuildContext } from "./"
import {
  markWebpackStatusAsPending,
  markWebpackStatusAsDone,
} from "../utils/webpack-status"
import { emitter } from "../redux"

export async function startWebpackServer({
  program,
  app,
  workerPool,
  store,
}: Partial<IBuildContext>): Promise<{
  compiler: Compiler
  websocketManager: WebsocketManager
  webpackWatching: WebpackWatching
}> {
  if (!program || !app || !store) {
    report.panic(`Missing required params`)
  }
  let { compiler, webpackActivity, websocketManager, webpackWatching } =
    await startServer(program, app, workerPool)

  compiler.hooks.invalid.tap(`log compiling`, function () {
    if (!webpackActivity) {
      // mark webpack as pending if we are not in the middle of compilation already
      // when input is invalidated during compilation, webpack will automatically
      // run another compilation round before triggering `done` event
      report.pendingActivity({ id: `webpack-develop` })
      markWebpackStatusAsPending()
    }
  })

  compiler.hooks.watchRun.tapAsync(`log compiling`, function (_, done) {
    if (!webpackActivity) {
      // there can be multiple `watchRun` events before receiving single `done` event
      // webpack will not emit assets or `done` event until all pending invalidated

View on GitHub (pinned to 8b06340921)

Solutions

  1. Run `gatsby clean` and restart `gatsby develop`.
  2. Update to the latest Gatsby version -- this is an internal invariant violation.
  3. If using Gatsby programmatically, ensure you pass a fully-constructed context with program, app (Express), and store.
  4. File a bug report if it reproduces on a clean install.
Defensive patterns

Strategy: validation

Validate before calling

// Validate required params before calling startWebpackServer
function validateDevServerContext(ctx) {
  if (!ctx.program) throw new Error('Missing program in dev server context')
  if (!ctx.app) throw new Error('Missing Express app in dev server context')
  if (!ctx.store) throw new Error('Missing Redux store in dev server context')
}

Type guard

function isValidDevServerContext(ctx) {
  return (
    typeof ctx === 'object' &&
    ctx !== null &&
    typeof ctx.program === 'object' &&
    typeof ctx.app === 'object' &&
    typeof ctx.store === 'object'
  )
}

Prevention

When it happens

Trigger: Calling startWebpackServer when the IBuildContext does not have program, app, or store populated. This is an internal invariant -- the develop bootstrap should have created all three before reaching this step.

Common situations: Internal state machine regression or ordering issue. Custom programmatic usage of Gatsby internals that doesn't set up the context properly. A crash in an earlier bootstrap step that left the context incomplete.

Related errors


AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13). Data as JSON: /api/errors/3f00150f97ad19bc. Report an issue: GitHub.