filamentphp/filament · error · Exception

Unknown toolbar buttons modification type: [{$modification['

Error message

Unknown toolbar buttons modification type: [{$modification['type']}].

What it means

`getToolbarButtons()` replays recorded toolbar modifications through a `match` that only supports `'disableAll'`, `'disable'`, and `'enable'`. Any modification carrying a different `'type'` value — typically merged in by a plugin through extra toolbar modifications — falls into the default arm and throws a plain Exception. This signals an internal-contract violation, not an end-user typo.

Source

Thrown at packages/forms/src/Components/Concerns/InteractsWithToolbarButtons.php:91

    }

    /**
     * @return array<array<string | object>>
     */
    public function getToolbarButtons(): array
    {
        $buttons = $this->evaluate($this->toolbarButtons) ?? $this->getDefaultToolbarButtons(); /** @phpstan-ignore method.notFound */

        // Extra modifications (e.g. from plugins) are applied first,
        // so that user-level modifications always take precedence.
        $modifications = [...$this->getExtraToolbarButtonsModifications(), ...$this->toolbarButtonsModifications];

        foreach ($modifications as $modification) {
            $buttons = match ($modification['type']) {
                'disableAll' => [],
                'disable' => $this->applyDisableToolbarButtonsModification($buttons, $modification['buttons']),
                'enable' => $this->applyEnableToolbarButtonsModification($buttons, $modification['buttons']),
                default => throw new Exception('Unknown toolbar buttons modification type: [' . $modification['type'] . '].'),
            };
        }

        // Group consecutive non-array items together; arrays become their own groups
        $toolbar = [];
        $newButtonGroup = [];

        foreach ($buttons as $buttonGroup) {
            if (blank($buttonGroup)) {
                continue;
            }

            if (! is_array($buttonGroup)) {
                $newButtonGroup[] = $buttonGroup;

                continue;
            }

View on GitHub (pinned to 53483fa934)

Solutions

  1. Use only the supported types: `'disableAll'`, `'disable'`, `'enable'`.
  2. Update the plugin/dependency to a release matching your Filament version.
  3. As a plugin author, override `getToolbarButtons()`/extra modifications instead of inventing new `type` values.

Example fix

// before (plugin code)
$this->toolbarButtonsModifications[] = ['type' => 'hide', 'buttons' => $buttons];

// after
$this->toolbarButtonsModifications[] = ['type' => 'disable', 'buttons' => $buttons];
Defensive patterns

Strategy: validation

Validate before calling

// Plugin authors: validate before merging modifications
$supportedTypes = ['disableAll', 'disable', 'enable'];

if (! in_array($modification['type'], $supportedTypes, true)) {
    throw new InvalidArgumentException(
        "Unsupported toolbar modification type [{$modification['type']}] for this Filament version."
    );
}

$this->toolbarButtonsModifications[] = $modification;

Type guard

function isSupportedToolbarModification(array $modification): bool
{
    return in_array($modification['type'] ?? null, ['disableAll', 'disable', 'enable'], true);
}

Try / catch

try {
    $buttons = $field->getToolbarButtons();
} catch (Exception $exception) {
    // A plugin pushed an unsupported modification type — disable the plugin path
    report()->error($exception);

    $buttons = $field->getDefaultToolbarButtons();
}

Prevention

When it happens

Trigger: A plugin or custom RichEditor subclass pushes `['type' => 'hide', 'buttons' => [...]]` (or any custom type) into the toolbar buttons modifications; or a plugin built against a different Filament version relies on types this version does not support.

Common situations: Upgrading Filament while a third-party editor plugin lags behind, or custom code copying the internal modifications array shape without matching the supported type set.

Related errors


AI-assisted analysis of filamentphp/filament@53483fa934 (2026-08-17). Data as JSON: /api/errors/fec34255d8131b93. Report an issue: GitHub.