{"record":{"id":"b6fc13c2cac70509","repo":"amir20/dozzle","slug":"container-s-not-found-in-any-client","errorCode":null,"errorMessage":"container %s not found in any client","messagePattern":"container (.+?) not found in any client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/notification/log_listener.go","lineNumber":185,"sourceCode":"func (l *ContainerLogListener) stopListening(containerID string) {\n\tif entry, exists := l.activeStreams.LoadAndDelete(containerID); exists {\n\t\tentry.cancel()\n\t\tl.containerClients.Delete(containerID)\n\t\tlog.Debug().Str(\"containerID\", containerID).Msg(\"Stopped listening to container\")\n\t}\n}\n\n// isListening returns true if listening to a container\nfunc (l *ContainerLogListener) isListening(containerID string) bool {\n\t_, exists := l.activeStreams.Load(containerID)\n\treturn exists\n}\n\n// FindContainer finds a container by ID using the client that owns it\nfunc (l *ContainerLogListener) FindContainer(ctx context.Context, id string, labels container.ContainerLabels) (container.Container, error) {\n\tclient, exists := l.containerClients.Load(id)\n\tif !exists {\n\t\treturn container.Container{}, fmt.Errorf(\"container %s not found in any client\", id)\n\t}\n\n\treturn client.FindContainer(ctx, id, labels)\n}\n\n// FindContainerWithHost finds a container and its host by container ID, using a TTL cache.\nfunc (l *ContainerLogListener) FindContainerWithHost(ctx context.Context, id string, labels container.ContainerLabels) (container.Container, container.Host, error) {\n\tif cached, ok := l.cache.Load(id); ok {\n\t\treturn cached.container, cached.host, nil\n\t}\n\n\tclient, exists := l.containerClients.Load(id)\n\tif !exists {\n\t\treturn container.Container{}, container.Host{}, fmt.Errorf(\"container %s not found in any client\", id)\n\t}\n\n\tc, err := client.FindContainer(ctx, id, labels)\n\tif err != nil {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/notification/log_listener.go#L167-L203","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the container ID is current: list containers and confirm the ID exists and is running.","Re-check after container restart; the mapping is repopulated when the container's log stream is re-subscribed.","Treat the error as expected for stopped/removed containers and skip alert evaluation for them."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Check the container is known before resolving\nif !listener.HasClient(containerID) {\n    return nil // skip: container unknown/stopped\n}","typeGuard":null,"tryCatchPattern":"c, err := listener.FindContainer(ctx, id, labels)\nif err != nil {\n    log.Printf(\"container %s unknown to listener, skipping\", id)\n    return container.Container{}, nil\n}","preventionTips":["Prefer label-based alert selectors over hard-coded container IDs.","Expect and tolerate this error for stopped/removed containers.","Re-resolve IDs after container recreation."],"tags":["notifications","container","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}