webpack/webpack · error · Error

No deserializer registered for ${key}

Error message

No deserializer registered for ${key}

What it means

getDeserializerFor looks up `serializerInversed` by the key `<request>/<name>` embedded in the cache; if no entry was registered in this process it throws `No deserializer registered for <key>` (lib/serialization/ObjectMiddleware.js:350-356). The cache references a serializer that the current webpack/plugin set never registered.

Source

Thrown at lib/serialization/ObjectMiddleware.js:355

			);
		}
		if (config === NOT_SERIALIZABLE) throw NOT_SERIALIZABLE;

		return /** @type {SerializerConfigWithSerializer} */ (config);
	}

	/**
	 * Gets deserializer for.
	 * @param {string} request request
	 * @param {string} name name
	 * @returns {ObjectSerializer} serializer
	 */
	static getDeserializerFor(request, name) {
		const key = `${request}/${name}`;
		const serializer = serializerInversed.get(key);

		if (serializer === undefined) {
			throw new Error(`No deserializer registered for ${key}`);
		}

		return serializer;
	}

	/**
	 * Get deserializer for without error.
	 * @param {string} request request
	 * @param {string} name name
	 * @returns {ObjectSerializer | undefined} serializer
	 */
	static _getDeserializerForWithoutError(request, name) {
		const key = `${request}/${name}`;
		const serializer = serializerInversed.get(key);
		return serializer;
	}

	/**

View on GitHub (pinned to 318421ea8a)

Solutions

  1. Delete the persistent cache so it rebuilds under the current set of registered serializers.
  2. Ensure the plugin that registers the serializer is loaded on every build that reads the cache.
  3. Keep the plugin set (and versions) consistent across team/CI.
  4. Set/bump `cache.version` when the plugin set changes so webpack invalidates the cache itself.

Example fix

// before: plugin A registered 'my-pkg/MyDep', then A was disabled -> cache read fails
// after: either re-enable the plugin, or invalidate the cache
config.cache = { type: 'filesystem', version: 'pluginset-v2' }; // bump on change
Defensive patterns

Strategy: validation

Validate before calling

// Before reading the cache, assert every serializer the build can write is also loadable
const { ObjectMiddleware } = require('webpack/lib/serialization/ObjectMiddleware');
function assertDeserializer(request, name) {
  if (ObjectMiddleware._getDeserializerForWithoutError(request, name) === undefined)
    throw new Error(`missing deserializer for ${request}/${name}; load the owning plugin`);
}

Try / catch

compiler.hooks.failed.tap('DeserializerGuard', (err) => {
  if (/No deserializer registered for/.test(err.message)) {
    require('fs').rmSync(cacheLocation, { recursive: true, force: true });
    console.error('Cache referenced an unregistered serializer; purged. Rebuild.');
  }
});

Prevention

When it happens

Trigger: Reading a persistent cache that was written by a build where a plugin/serializer was loaded, but the current build does not load that plugin (or loads a version without that serializer). The key in the cache has no matching `serializerInversed` entry.

Common situations: Disabling or removing a plugin whose types were previously cached; downgrading webpack or a plugin that no longer registers a class; loading plugins conditionally so the serializer set differs between builds; team members with different plugin configurations sharing a cache.

Related errors


AI-assisted analysis of webpack/webpack@318421ea8a (2026-08-03). Data as JSON: /data/errors/d97baa690e5c999d.json. Report an issue: GitHub.