{"record":{"id":"fec34255d8131b93","repo":"filamentphp/filament","slug":"unknown-toolbar-buttons-modification-type-modi","errorCode":null,"errorMessage":"Unknown toolbar buttons modification type: [{$modification['type']}].","messagePattern":"Unknown toolbar buttons modification type: \\[(.+?)\\]\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"packages/forms/src/Components/Concerns/InteractsWithToolbarButtons.php","lineNumber":91,"sourceCode":"    }\n\n    /**\n     * @return array<array<string | object>>\n     */\n    public function getToolbarButtons(): array\n    {\n        $buttons = $this->evaluate($this->toolbarButtons) ?? $this->getDefaultToolbarButtons(); /** @phpstan-ignore method.notFound */\n\n        // Extra modifications (e.g. from plugins) are applied first,\n        // so that user-level modifications always take precedence.\n        $modifications = [...$this->getExtraToolbarButtonsModifications(), ...$this->toolbarButtonsModifications];\n\n        foreach ($modifications as $modification) {\n            $buttons = match ($modification['type']) {\n                'disableAll' => [],\n                'disable' => $this->applyDisableToolbarButtonsModification($buttons, $modification['buttons']),\n                'enable' => $this->applyEnableToolbarButtonsModification($buttons, $modification['buttons']),\n                default => throw new Exception('Unknown toolbar buttons modification type: [' . $modification['type'] . '].'),\n            };\n        }\n\n        // Group consecutive non-array items together; arrays become their own groups\n        $toolbar = [];\n        $newButtonGroup = [];\n\n        foreach ($buttons as $buttonGroup) {\n            if (blank($buttonGroup)) {\n                continue;\n            }\n\n            if (! is_array($buttonGroup)) {\n                $newButtonGroup[] = $buttonGroup;\n\n                continue;\n            }\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/filamentphp/filament/blob/53483fa9340e4ec637985fe454ebb58afb92ea24/packages/forms/src/Components/Concerns/InteractsWithToolbarButtons.php#L73-L109","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use only the supported types: `'disableAll'`, `'disable'`, `'enable'`.","Update the plugin/dependency to a release matching your Filament version.","As a plugin author, override `getToolbarButtons()`/extra modifications instead of inventing new `type` values."],"exampleFix":"// before (plugin code)\n$this->toolbarButtonsModifications[] = ['type' => 'hide', 'buttons' => $buttons];\n\n// after\n$this->toolbarButtonsModifications[] = ['type' => 'disable', 'buttons' => $buttons];","handlingStrategy":"validation","validationCode":"// Plugin authors: validate before merging modifications\n$supportedTypes = ['disableAll', 'disable', 'enable'];\n\nif (! in_array($modification['type'], $supportedTypes, true)) {\n    throw new InvalidArgumentException(\n        \"Unsupported toolbar modification type [{$modification['type']}] for this Filament version.\"\n    );\n}\n\n$this->toolbarButtonsModifications[] = $modification;","typeGuard":"function isSupportedToolbarModification(array $modification): bool\n{\n    return in_array($modification['type'] ?? null, ['disableAll', 'disable', 'enable'], true);\n}","tryCatchPattern":"try {\n    $buttons = $field->getToolbarButtons();\n} catch (Exception $exception) {\n    // A plugin pushed an unsupported modification type — disable the plugin path\n    report()->error($exception);\n\n    $buttons = $field->getDefaultToolbarButtons();\n}","preventionTips":["Pin plugin versions to releases tested against your Filament version.","As a plugin author, encode the supported type set in a shared constant and validate before merging.","Run a smoke render of editor fields in staging after upgrades."],"tags":["filament","rich-editor","plugins","internal-api","version-mismatch"],"backgroundTag":"unsupported-modification-type","analyzedSha":"53483fa9340e4ec637985fe454ebb58afb92ea24","analyzedAt":"2026-08-17T02:06:23.049Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}