amir20/dozzle · warning

container not found in any client

Error message

container %s not found in any client

What it means

ContainerLogListener.FindContainer looks up the client that owns a container in the listener's containerClients sync-map (populated as log streams are subscribed). If no client is registered for the given container ID, it returns this error instead of delegating. It means the listener never saw (or has forgotten) this container, so it cannot resolve it.

Solutions

  1. Verify the container ID is current: list containers and confirm the ID exists and is running.
  2. Re-check after container restart; the mapping is repopulated when the container's log stream is re-subscribed.
  3. Treat the error as expected for stopped/removed containers and skip alert evaluation for them.
Defensive patterns

Strategy: fallback

Validate before calling

// Check the container is known before resolving
if !listener.HasClient(containerID) {
    return nil // skip: container unknown/stopped
}

Try / catch

c, err := listener.FindContainer(ctx, id, labels)
if err != nil {
    log.Printf("container %s unknown to listener, skipping", id)
    return container.Container{}, nil
}

Prevention

When it happens

Trigger: Calling FindContainer with a container ID that has no entry in l.containerClients: the container stopped and its client mapping was removed, the ID is wrong/stale, or the lookup happens before any log event established the mapping.

Common situations: Evaluating alert rules against a container that just exited, restoring a persisted rule referencing a deleted container, or a race where a notification fires after the listener dropped the container.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/b6fc13c2cac70509. Report an issue: GitHub.

Appendix: source

Thrown at internal/notification/log_listener.go:185

func (l *ContainerLogListener) stopListening(containerID string) {
	if entry, exists := l.activeStreams.LoadAndDelete(containerID); exists {
		entry.cancel()
		l.containerClients.Delete(containerID)
		log.Debug().Str("containerID", containerID).Msg("Stopped listening to container")
	}
}

// isListening returns true if listening to a container
func (l *ContainerLogListener) isListening(containerID string) bool {
	_, exists := l.activeStreams.Load(containerID)
	return exists
}

// FindContainer finds a container by ID using the client that owns it
func (l *ContainerLogListener) FindContainer(ctx context.Context, id string, labels container.ContainerLabels) (container.Container, error) {
	client, exists := l.containerClients.Load(id)
	if !exists {
		return container.Container{}, fmt.Errorf("container %s not found in any client", id)
	}

	return client.FindContainer(ctx, id, labels)
}

// FindContainerWithHost finds a container and its host by container ID, using a TTL cache.
func (l *ContainerLogListener) FindContainerWithHost(ctx context.Context, id string, labels container.ContainerLabels) (container.Container, container.Host, error) {
	if cached, ok := l.cache.Load(id); ok {
		return cached.container, cached.host, nil
	}

	client, exists := l.containerClients.Load(id)
	if !exists {
		return container.Container{}, container.Host{}, fmt.Errorf("container %s not found in any client", id)
	}

	c, err := client.FindContainer(ctx, id, labels)
	if err != nil {

View on GitHub (pinned to d9463cbe21)