filamentphp/filament · error · LogicException

Invalid color mapping key [{$key}].

Error message

Invalid color mapping key [{$key}].

What it means

Error "Invalid color mapping key [{$key}]." thrown in filamentphp/filament.

Source

Thrown at packages/support/src/Colors/ColorManager.php:153

        if (! $resolvedColor) {
            return $this->componentClasses[$componentKey][$color] = $classes;
        }

        $map = $component->getColorMap($resolvedColor);

        return $this->componentClasses[$componentKey][$color] = [
            ...$classes,
            ...array_map(
                fn (string $shade, string $key): string => match ($key) {
                    'bg' => "fi-bg-color-{$shade}",
                    'dark:bg' => "dark:fi-bg-color-{$shade}",
                    'dark:hover:bg' => "dark:hover:fi-bg-color-{$shade}",
                    'dark:hover:text' => "dark:hover:fi-text-color-{$shade}",
                    'dark:text' => "dark:fi-text-color-{$shade}",
                    'hover:bg' => "hover:fi-bg-color-{$shade}",
                    'hover:text' => "hover:fi-text-color-{$shade}",
                    'text' => "fi-text-color-{$shade}",
                    default => throw new LogicException("Invalid color mapping key [{$key}]."),
                },
                array_values($map),
                array_keys($map),
            ),
        ];
    }

    /**
     * @param  class-string<HasColor> | HasColor  $component
     * @param  array<string>  $color
     * @return array<string>
     */
    public function getComponentCustomStyles(string | HasColor $component, array $color): array
    {
        $componentKey = is_string($component) ? $component : serialize($component);
        $colorKey = serialize($color);

        if (isset($this->componentCustomStyles[$componentKey][$colorKey])) {

View on GitHub (pinned to 53483fa934)

When it happens

Trigger: Thrown at packages/support/src/Colors/ColorManager.php:153 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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