{"record":{"id":"3bfa84e870aabc50","repo":"coollabsio/coolify","slug":"could-not-get-or-generate-proxy-configuration","errorCode":null,"errorMessage":"Could not get or generate proxy configuration","messagePattern":"Could not get or generate proxy configuration","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Actions/Proxy/GetProxyConfiguration.php","lineNumber":63,"sourceCode":"\n        // Generate default configuration as last resort\n        if ($forceRegenerate || empty(trim($proxy_configuration ?? ''))) {\n            $custom_commands = [];\n            if (! empty(trim($proxy_configuration ?? ''))) {\n                $custom_commands = extractCustomProxyCommands($server, $proxy_configuration);\n            }\n\n            Log::warning('Proxy configuration regenerated to defaults', [\n                'server_id' => $server->id,\n                'server_name' => $server->name,\n                'reason' => $forceRegenerate ? 'force_regenerate' : 'config_not_found',\n            ]);\n\n            $proxy_configuration = str(generateDefaultProxyConfiguration($server, $custom_commands))->trim()->value();\n        }\n\n        if (empty($proxy_configuration)) {\n            throw new \\Exception('Could not get or generate proxy configuration');\n        }\n\n        ProxyDashboardCacheService::isTraefikDashboardAvailableFromConfiguration($server, $proxy_configuration);\n\n        return $proxy_configuration;\n    }\n\n    /**\n     * Check that the stored docker-compose YAML contains the expected service\n     * for the server's current proxy type. Returns false if the config belongs\n     * to a different proxy type (e.g. Traefik config on a CADDY server).\n     */\n    private function configMatchesProxyType(string $proxyType, string $configuration): bool\n    {\n        try {\n            $yaml = Yaml::parse($configuration);\n            $services = data_get($yaml, 'services', []);\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Actions/Proxy/GetProxyConfiguration.php#L45-L81","documentation":"\\Exception from GetProxyConfiguration when $proxy_configuration is still empty after both the stored configuration lookup and the fallback regeneration via generateDefaultProxyConfiguration($server, $custom_commands). The action even logs a 'Proxy configuration regenerated to defaults' warning before rebuilding, so this throw means regeneration itself produced an empty string - the server's proxy type/definition yielded no usable docker-compose content.","triggerScenarios":"Server proxy_type set to something with no template (CUSTOM/NONE or a corrupted value); generateDefaultProxyConfiguration returning empty because the resolved proxy type has no generator; empty config file on disk plus a regeneration path that short-circuits (e.g. unknown proxy type string after an upgrade or manual DB edit).","commonSituations":"Manually edited server.proxy JSON in the database leaving an unrecognized type; version upgrade introducing/renaming proxy types while stored config lags; disk full or permission issue making the stored file read as empty; swarm/local mismatches after switching server modes.","solutions":["Re-set the proxy type explicitly: Server -> Proxy -> select Traefik (or Caddy), save, then restart proxy to force regeneration.","Inspect $server->proxy (type, force_stop) and proxyPath() contents on the server for a corrupted/empty docker-compose.","Check the log for the preceding 'Proxy configuration regenerated to defaults' entry to confirm which branch (config_not_found vs force_regenerate) ran, and fix accordingly."],"exampleFix":"// before\n$proxy_configuration = str(generateDefaultProxyConfiguration($server, $custom_commands))->trim()->value();\n...\nif (empty($proxy_configuration)) {\n    throw new \\Exception('Could not get or generate proxy configuration');\n}\n\n// after (fail with actionable context)\nif (empty($proxy_configuration)) {\n    throw new \\Exception('Could not get or generate proxy configuration for proxy type '.$server->proxyType().' on server '.$server->name);\n}","handlingStrategy":"fallback","validationCode":"$proxyType = $server->proxyType();\nif (! in_array($proxyType, [\\App\\Enums\\ProxyTypes::TRAEFIK->value, \\App\\Enums\\ProxyTypes::CADDY->value], true)) {\n    // set a supported proxy type before requesting configuration\n    return;\n}","typeGuard":"function hasSupportedProxyType(\\App\\Models\\Server $server): bool\n{\n    return in_array($server->proxyType(), ['TRAEFIK', 'CADDY'], true);\n}","tryCatchPattern":"try {\n    $config = GetProxyConfiguration::run($server, forceRegenerate: true);\n} catch (\\Exception $e) {\n    if ($e->getMessage() === 'Could not get or generate proxy configuration') {\n        // reset proxy type to TRAEFIK, save, regenerate\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Set proxy type via the UI only; never hand-edit server.proxy JSON.","After upgrades, re-save Server -> Proxy settings so stored configs match current generators.","Monitor logs for the 'Proxy configuration regenerated to defaults' warning as an early signal."],"tags":["proxy","configuration","traefik","caddy","server-settings"],"backgroundTag":"configuration-generation-failed","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}