{"record":{"id":"a376e3ae671ffdc1","repo":"coollabsio/coolify","slug":"duplicate-environment-variable-key-after-normaliza","errorCode":null,"errorMessage":"Duplicate environment variable key after normalization: {$normalizedKey}.","messagePattern":"Duplicate environment variable key after normalization: (.+?)\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"app/Livewire/Project/Shared/EnvironmentVariable/All.php","lineNumber":1023,"sourceCode":"                }\n            }\n        }\n\n        // If we get here, no variables are used in Docker Compose, so we can delete them\n        $this->resource->$method()->whereNotIn('key', array_keys($variables))->delete();\n\n        return $variablesToDelete->count();\n    }\n\n    private function normalizeEnvironmentVariables(array $variables): array\n    {\n        $normalizedVariables = [];\n\n        foreach ($variables as $key => $data) {\n            $normalizedKey = ValidationPatterns::validatedEnvironmentVariableKey((string) $key);\n\n            if (array_key_exists($normalizedKey, $normalizedVariables)) {\n                throw new \\InvalidArgumentException(\"Duplicate environment variable key after normalization: {$normalizedKey}.\");\n            }\n\n            $normalizedVariables[$normalizedKey] = $data;\n        }\n\n        return $normalizedVariables;\n    }\n\n    private function updateOrCreateVariables($isPreview, $variables)\n    {\n        $count = 0;\n        foreach ($variables as $key => $data) {\n            if (str($key)->startsWith('SERVICE_FQDN') || str($key)->startsWith('SERVICE_URL') || str($key)->startsWith('SERVICE_NAME')) {\n                continue;\n            }\n\n            // Extract value and comment from parsed data\n            // Handle both array format ['value' => ..., 'comment' => ...] and plain string values","sourceCodeStart":1005,"sourceCodeEnd":1041,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Project/Shared/EnvironmentVariable/All.php#L1005-L1041","documentation":"Error \"Duplicate environment variable key after normalization: {$normalizedKey}.\" thrown in coollabsio/coolify.","triggerScenarios":"Thrown at app/Livewire/Project/Shared/EnvironmentVariable/All.php:1023 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}