coollabsio/coolify · warning · MultipleContainersException

Service has multiple containers. Call get_logs with resource

Error message

Service has multiple containers. Call get_logs with resource=service_application or service_database and the child uuid.

What it means

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.

Source

Thrown at app/Mcp/Tools/GetLogs.php:278

            $total = $apps->count() + $dbs->count();

            if ($total === 0) {
                throw new \RuntimeException('Service has no containers.');
            }

            // Multi-container services need an explicit child resource type.
            if ($total > 1) {
                $choices = $apps->map(fn ($app) => [
                    'resource' => 'service_application',
                    'uuid' => $app->uuid,
                    'name' => $app->name,
                ])->concat($dbs->map(fn ($db) => [
                    'resource' => 'service_database',
                    'uuid' => $db->uuid,
                    'name' => $db->name,
                ]))->values()->all();

                throw new MultipleContainersException(
                    'Service has multiple containers. Call get_logs with resource=service_application or service_database and the child uuid.',
                    $choices,
                );
            }

            $child = $apps->first() ?? $dbs->first();
            $containerName = $child->name.'-'.$resource->uuid;
            $status = getContainerStatus($server, $containerName);
            if ($status !== 'running') {
                throw new \RuntimeException('Service container is not running.');
            }

            return (string) getContainerLogs($server, $containerName, $lines, $showTimestamps);
        }

        if ($resource instanceof ServiceApplication || $resource instanceof ServiceDatabase) {
            $service = $resource->service;
            $server = $service?->server;

View on GitHub (pinned to 70b9acc424)

Solutions

  1. Re-call get_logs with resource='service_application' or 'service_database' plus the child uuid taken from the exception's choices array.
  2. Pick the child by its name field (e.g. 'app' vs 'db') when you care about a specific component.

Example fix

// before
get_logs(resource: 'service', uuid: $service->uuid);

// after
get_logs(resource: 'service_application', uuid: $choices[0]['uuid']);
Defensive patterns

Strategy: try-catch

Try / catch

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); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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