symfony/symfony · error · Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
The "marshaller" attribute of the "cache.pool" tag for servi
Error message
The "marshaller" attribute of the "cache.pool" tag for service "%s" is not supported by chained adapter "%s".
What it means
CachePoolPass supports a 'marshaller' attribute on the cache.pool tag to inject a custom serializer (e.g. for igbinary or encrypted marshalling). For chained adapters, the marshaller is injected into each constituent adapter. If a chained adapter does not wire 'cache.default_marshaller' in its constructor arguments (meaning it has no marshaller slot) and it is not ArrayAdapter or NullAdapter (which legitimately don't need one), the pass cannot inject the marshaller and throws an InvalidArgumentException at compile time.
Source
Thrown at src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php:145
$chainedPool->replaceArgument($i++, $tags[0]['namespace']);
}
if (isset($tags[0]['default_lifetime'])) {
$defaultLifetime = $tags[0]['default_lifetime'];
if (!is_numeric($defaultLifetime)) {
$defaultLifetime = (new Definition('int', [$defaultLifetime]))
->setFactory([ParameterNormalizer::class, 'normalizeDuration']);
}
$chainedPool->replaceArgument($i++, $defaultLifetime);
}
if (null !== $marshallerServiceId) {
if (null !== $marshallerIndex = $this->findDefaultMarshallerArgumentIndex($adapter)) {
$chainedPool->replaceArgument($marshallerIndex, new Reference($marshallerServiceId));
} elseif (!\in_array($chainedClass, [ArrayAdapter::class, NullAdapter::class], true)) {
throw new InvalidArgumentException(\sprintf('The "marshaller" attribute of the "cache.pool" tag for service "%s" is not supported by chained adapter "%s".', $id, $chainedClass));
}
}
$adapters[] = $chainedPool;
}
$pool->replaceArgument(0, $adapters);
unset($tags[0]['provider'], $tags[0]['namespace']);
$i = 1;
} else {
$i = 0;
}
foreach ($attributes as $attr) {
if (!isset($tags[0][$attr])) {
// no-op
} elseif ('reset' === $attr) {
if ($tags[0][$attr]) {View on GitHub (pinned to 698e28026c)
Solutions
- Remove the 'marshaller' attribute from the cache.pool tag for this service.
- Ensure each chained adapter's service definition wires 'cache.default_marshaller' as a constructor argument (check findDefaultMarshallerArgumentIndex logic).
- Use only built-in adapters (RedisAdapter, PdoAdapter, etc.) in the chain, which already wire the marshaller argument.
- Add cache.default_marshaller as a constructor argument to your custom adapter definition.
Example fix
// before
my_custom_adapter:
class: App\Cache\MyCustomAdapter
arguments: ['%dsn%']
tags:
- { name: cache.pool, marshaller: my.marshaller }
// after — wire the marshaller argument
my_custom_adapter:
class: App\Cache\MyCustomAdapter
arguments: ['%dsn%', '@cache.default_marshaller']
tags:
- { name: cache.pool, marshaller: my.marshaller } Defensive patterns
Strategy: validation
Validate before calling
// In services.yaml: ensure chained adapters wire cache.default_marshaller
# my.adapter:
# arguments: ['%dsn%', '@cache.default_marshaller']
# Only then add: tags: [{ name: cache.pool, marshaller: my.marshaller }] Prevention
- Ensure every adapter in a chain accepts cache.default_marshaller as a constructor argument.
- Use stock Symfony adapters in chains; they already wire the marshaller.
- Remove the marshaller attribute if using ArrayAdapter/NullAdapter in a chain.
When it happens
Trigger: Tagging a ChainAdapter-based pool with { marshaller: 'my.marshaller' } when one of the chained adapters is a custom adapter class whose definition does not accept cache.default_marshaller as a constructor argument.
Common situations: Using a custom adapter class in a chain that doesn't follow the standard Symfony adapter constructor signature, or removing the marshaller argument from a stock adapter definition override.
Related errors
- Invalid service "%s": chain of adapters cannot reference ano
- The "marshaller" attribute of the "cache.pool" tag for servi
- Invalid "cache.pool" tag for service "%s": accepted attribut
- At least one adapter must be specified.
- Please upgrade the "igbinary" PHP extension to v3.1.6 or hig
AI-assisted analysis of symfony/symfony@698e28026c (2026-08-06).
Data as JSON: /api/errors/0d34ee881d02f231.
Report an issue: GitHub.