coollabsio/coolify · error · InvalidArgumentException

Duplicate environment variable key after normalization: {$no

Error message

Duplicate environment variable key after normalization: {$normalizedKey}.

What it means

Error "Duplicate environment variable key after normalization: {$normalizedKey}." thrown in coollabsio/coolify.

Source

Thrown at app/Livewire/Project/Shared/EnvironmentVariable/All.php:1023

                }
            }
        }

        // If we get here, no variables are used in Docker Compose, so we can delete them
        $this->resource->$method()->whereNotIn('key', array_keys($variables))->delete();

        return $variablesToDelete->count();
    }

    private function normalizeEnvironmentVariables(array $variables): array
    {
        $normalizedVariables = [];

        foreach ($variables as $key => $data) {
            $normalizedKey = ValidationPatterns::validatedEnvironmentVariableKey((string) $key);

            if (array_key_exists($normalizedKey, $normalizedVariables)) {
                throw new \InvalidArgumentException("Duplicate environment variable key after normalization: {$normalizedKey}.");
            }

            $normalizedVariables[$normalizedKey] = $data;
        }

        return $normalizedVariables;
    }

    private function updateOrCreateVariables($isPreview, $variables)
    {
        $count = 0;
        foreach ($variables as $key => $data) {
            if (str($key)->startsWith('SERVICE_FQDN') || str($key)->startsWith('SERVICE_URL') || str($key)->startsWith('SERVICE_NAME')) {
                continue;
            }

            // Extract value and comment from parsed data
            // Handle both array format ['value' => ..., 'comment' => ...] and plain string values

View on GitHub (pinned to 70b9acc424)

When it happens

Trigger: Thrown at app/Livewire/Project/Shared/EnvironmentVariable/All.php:1023 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17). Data as JSON: /api/errors/a376e3ae671ffdc1. Report an issue: GitHub.