gatsbyjs/gatsby · error · Error
You must pass an object into setPluginStatus. What was passe
Error message
You must pass an object into setPluginStatus. What was passed in was ${JSON.stringify(action.payload, null, 4)} What it means
The status reducer's SET_PLUGIN_STATUS case validates that action.payload is an object (via lodash _.isObject) before merging it into state.plugins[plugin.name]. It throws with a JSON dump of the bad payload if a non-object (string, number, array, null, etc.) is passed, because _.merge of a non-object would corrupt or overwrite plugin status incorrectly.
Source
Thrown at packages/gatsby/src/redux/reducers/status.ts:38
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
- Pass a plain object: setPluginStatus({ key: value }).
- If you serialized status to JSON, JSON.parse it before passing.
- Wrap arrays/scalars in an object: setPluginStatus({ items: arr }).
Example fix
// before
actions.setPluginStatus('synced')
// after
actions.setPluginStatus({ lastSync: new Date().toISOString() }) Defensive patterns
Strategy: type-guard
Validate before calling
function safeSetPluginStatus(actions, payload) {
if (payload === null || typeof payload !== 'object' || Array.isArray(payload)) {
throw new TypeError('setPluginStatus payload must be a plain object')
}
return actions.setPluginStatus(payload)
} Type guard
function isPlainObject(x) {
return !!x && typeof x === 'object' && !Array.isArray(x)
} Prevention
- Always pass a plain object literal to setPluginStatus.
- If you serialized status, JSON.parse before sending.
- Wrap arrays/scalars in an object key.
When it happens
Trigger: Calling setPluginStatus with a primitive, string, array, or null/undefined payload. Note _.isObject returns true for arrays and functions too, so practically this fires for strings, numbers, booleans, and null.
Common situations: Passing a scalar where an object was intended (e.g. setPluginStatus('done') instead of setPluginStatus({ state: 'done' })); serializing status to a JSON string and forgetting to parse it; passing a configuration value directly.
Related errors
- An ID must be provided when creating or setting job
- An ID must be provided when ending a job
- You can't set plugin status without a plugin
- generateImageSource must be a function
- The plugin "${_.get(action, `plugin.name`, `anonymous`)}" tr
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/36ad5864452882a4.
Report an issue: GitHub.