{"record":{"id":"78019636e2e238c7","repo":"coollabsio/coolify","slug":"service-has-multiple-containers-call-get-logs-wit","errorCode":null,"errorMessage":"Service has multiple containers. Call get_logs with resource=service_application or service_database and the child uuid.","messagePattern":"Service has multiple containers\\. Call get_logs with resource=service_application or service_database and the child uuid\\.","errorType":"exception","errorClass":"MultipleContainersException","httpStatus":null,"severity":"warning","filePath":"app/Mcp/Tools/GetLogs.php","lineNumber":278,"sourceCode":"            $total = $apps->count() + $dbs->count();\n\n            if ($total === 0) {\n                throw new \\RuntimeException('Service has no containers.');\n            }\n\n            // Multi-container services need an explicit child resource type.\n            if ($total > 1) {\n                $choices = $apps->map(fn ($app) => [\n                    'resource' => 'service_application',\n                    'uuid' => $app->uuid,\n                    'name' => $app->name,\n                ])->concat($dbs->map(fn ($db) => [\n                    'resource' => 'service_database',\n                    'uuid' => $db->uuid,\n                    'name' => $db->name,\n                ]))->values()->all();\n\n                throw new MultipleContainersException(\n                    'Service has multiple containers. Call get_logs with resource=service_application or service_database and the child uuid.',\n                    $choices,\n                );\n            }\n\n            $child = $apps->first() ?? $dbs->first();\n            $containerName = $child->name.'-'.$resource->uuid;\n            $status = getContainerStatus($server, $containerName);\n            if ($status !== 'running') {\n                throw new \\RuntimeException('Service container is not running.');\n            }\n\n            return (string) getContainerLogs($server, $containerName, $lines, $showTimestamps);\n        }\n\n        if ($resource instanceof ServiceApplication || $resource instanceof ServiceDatabase) {\n            $service = $resource->service;\n            $server = $service?->server;","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Mcp/Tools/GetLogs.php#L260-L296","documentation":"Coolify's MCP get_logs tool can stream logs from exactly one container. When the addressed Service has more than one child (service applications plus service databases), fetchLogs() throws MultipleContainersException, a RuntimeException carrying a public $choices array of {resource, uuid, name} entries, instructing the caller (usually an LLM agent) to re-invoke the tool with resource=service_application|service_database and the chosen child's uuid.","triggerScenarios":"Calling get_logs with resource='service' and the service uuid on any stack with 2+ children — e.g. an app plus a database, or one-click templates like Plausible/Supabase that bundle several services.","commonSituations":"An AI assistant is asked for 'the logs of my service' and hits a multi-container stack; the disambiguation bounce is by design so logs come from a single well-defined container.","solutions":["Re-call get_logs with resource='service_application' or 'service_database' plus the child uuid taken from the exception's choices array.","Pick the child by its name field (e.g. 'app' vs 'db') when you care about a specific component."],"exampleFix":"// before\nget_logs(resource: 'service', uuid: $service->uuid);\n\n// after\nget_logs(resource: 'service_application', uuid: $choices[0]['uuid']);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { $logs = $this->fetchLogs($resource, $resourceType, $lines, $showTimestamps); } catch (MultipleContainersException $e) { $choice = collect($e->choices)->firstWhere('name', 'app') ?? $e->choices[0]; $logs = $this->fetchLogsByUuid($choice['uuid'], $choice['resource'], $lines, $showTimestamps); }","preventionTips":["When scripting against the MCP tool, pre-fetch service children and call get_logs with the child resource type directly.","Treat MultipleContainersException as a redirect, not an error: its choices array is the continuation token.","Name service children distinctively ('app', 'db') so choice-by-name is deterministic."],"tags":["mcp","logs","services","disambiguation","coolify"],"backgroundTag":"ambiguous-resource-resolution","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}