{"record":{"id":"a8edc05ecfb77813","repo":"coollabsio/coolify","slug":"unknown-log-drain-type","errorCode":null,"errorMessage":"Unknown log drain type.","messagePattern":"Unknown log drain type\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"app/Actions/Server/StartLogDrain.php","lineNumber":137,"sourceCode":"    Host            api.axiom.co\n    Port            443\n    URI             /v1/datasets/\\${AXIOM_DATASET_NAME}/ingest\n    # Authorization Bearer should be an API token\n    Header Authorization Bearer \\${AXIOM_API_KEY}\n    compress gzip\n    format json\n    json_date_key _time\n    json_date_format iso8601\n    tls On\n\");\n            } elseif ($type === 'custom') {\n                if (! $server->settings->is_logdrain_custom_enabled) {\n                    throw new \\Exception('Custom log drain is not enabled.');\n                }\n                $config = base64_encode($server->settings->logdrain_custom_config);\n                $parsers = base64_encode($server->settings->logdrain_custom_config_parser);\n            } else {\n                throw new \\Exception('Unknown log drain type.');\n            }\n            if ($type !== 'custom') {\n                $parsers = base64_encode(\"\n[PARSER]\n    Name        empty_line_skipper\n    Format      regex\n    Regex       /^(?!\\s*$).+/\n\");\n            }\n            $compose = base64_encode('\nservices:\n  coolify-log-drain:\n    image: cr.fluentbit.io/fluent/fluent-bit:2.0\n    container_name: coolify-log-drain\n    command: -c /fluent-bit.conf\n    env_file:\n      - .env\n    volumes:","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Actions/Server/StartLogDrain.php#L119-L155","documentation":"The else of the first exhaustive if/elseif chain over $type in StartLogDrain. $type can only be one of 'none', 'newrelic', 'highlight', 'axiom', 'custom' — all set from settings flags at lines 17-27 — and every value has a branch, so this is an invariant assertion against future refactors (e.g. someone adds a new type detection without a config branch). Not reachable through the current settings-driven flow.","triggerScenarios":"Only via code change: extending the type detection to return a new provider without adding a matching config branch, or directly invoking handle() with tampered flow. No runtime input reaches it today.","commonSituations":"Maintainer refactors of the log-drain type detection; forks that add providers (e.g. Datadog) and forget the config chain.","solutions":["If you added a new drain type upstream in detection, add the corresponding config branch here and the env branch at line ~190.","Otherwise treat as an internal bug: capture $type in logs and report the inconsistent state."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$type = $server->isLogDrainEnabled() ? activeLogDrainType($server) : 'none';\nin_array($type, ['none', 'newrelic', 'highlight', 'axiom', 'custom'], true)\n    || throw new \\InvalidArgumentException('Unsupported log drain type: '.$type);","typeGuard":"function isValidLogDrainType(string $type): bool\n{\n    return in_array($type, ['none', 'newrelic', 'highlight', 'axiom', 'custom'], true);\n}","tryCatchPattern":"try {\n    StartLogDrain::run($server);\n} catch (\\Exception $e) {\n    if (str_contains($e->getMessage(), 'Unknown log drain type')) {\n        // invariant violation / fork drift: log $type and report, do not retry\n        report('StartLogDrain hit unknown type invariant: '.$e->getMessage());\n    } else {\n        throw $e;\n    }\n}","preventionTips":["If you fork/extend log-drain providers, update detection, the config chain AND the env chain together.","Add a test iterating every detectable type asserting both chains are exhaustive.","Never pass a hand-crafted type into handle(); it derives the type itself from settings."],"tags":["log-drain","fluent-bit","dead-code","invariant"],"backgroundTag":"invalid-log-drain-type","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}