gatsbyjs/gatsby · error · Error

You can't set plugin status without a plugin

Error message

You can't set plugin status without a plugin

What it means

The status reducer's SET_PLUGIN_STATUS case stores per-plugin status under state.plugins[plugin.name]; it throws if action.plugin or action.plugin.name is missing because there is no key to store the status under. The public actions.setPluginStatus wrapper supplies the plugin automatically, so reaching this throw means the action was dispatched without plugin context.

Source

Thrown at packages/gatsby/src/redux/reducers/status.ts:35

    case `DELETE_CACHE`:
      return {
        ...defaultState,
        cdnObfuscatedPrefix: state.cdnObfuscatedPrefix ?? ``,
      }
    case `INIT`: {
      if (!state.cdnObfuscatedPrefix) {
        state.cdnObfuscatedPrefix = uuid.v4()
      }
      return state
    }
    case `UPDATE_PLUGINS_HASH`:
      return {
        ...state,
        PLUGINS_HASH: action.payload,
      }
    case `SET_PLUGIN_STATUS`:
      if (!action.plugin || !action.plugin?.name) {
        throw new Error(`You can't set plugin status without a plugin`)
      }
      if (!_.isObject(action.payload)) {
        throw new Error(
          `You must pass an object into setPluginStatus. What was passed in was ${JSON.stringify(
            action.payload,
            null,
            4
          )}`
        )
      }
      return {
        ...state,
        plugins: {
          ...state.plugins,
          [action.plugin.name]: _.merge(
            {},
            state.plugins[action.plugin.name],
            action.payload

View on GitHub (pinned to 8b06340921)

Solutions

  1. Call actions.setPluginStatus(...) from within a Gatsby Node API (onPreBootstrap, etc.) where plugin is bound.
  2. If dispatching manually, include `plugin: { name: 'your-plugin' }` on the action.
  3. Ensure you are on a compatible Gatsby version for the plugin in question.

Example fix

// before
store.dispatch({ type: `SET_PLUGIN_STATUS`, payload: { lastRun: Date.now() } })
// after
store.dispatch({ type: `SET_PLUGIN_STATUS`, plugin: { name: `my-plugin` }, payload: { lastRun: Date.now() } })
Defensive patterns

Strategy: validation

Validate before calling

function safeSetPluginStatus(actions, plugin, payload) {
  if (!plugin?.name) throw new Error('setPluginStatus requires plugin.name')
  return actions.setPluginStatus(payload)
}

Type guard

function hasPlugin(action) {
  return !!action?.plugin?.name
}

Prevention

When it happens

Trigger: Dispatching SET_PLUGIN_STATUS with action.plugin undefined/null or action.plugin.name falsy. End users normally hit it only via setPluginStatus when the action context has been stripped (manual dispatch, misconfigured test harness).

Common situations: A plugin calling the internal store dispatch directly; a test mocking the store without plugin context; an outdated plugin relying on removed internal plumbing that no longer attaches plugin metadata.

Related errors


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