amir20/dozzle · error

container not found in pod

Error message

container %s not found in pod %s

What it means

FindContainer decoded the container id into namespace/pod/container, fetched the pod successfully, but none of the pod's container statuses produced a matching ID. This typically means the pod was restarted/rescheduled (id stale) or the requested container name is not (or no longer) part of the pod.

Solutions

  1. Refresh the container list; the pod likely restarted and container IDs changed.
  2. Verify the requested container name exists in the pod spec.
  3. Handle this as a 404-style error in the UI and prompt the user to reselect the container.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/k8s/client.go:539 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at internal/k8s/client.go:539

	}
}

func (k *K8sClient) FindContainer(ctx context.Context, id string) (container.Container, error) {
	log.Debug().Str("id", id).Msg("Finding container")
	namespace, podName, containerName := parsePodContainerID(id)

	pod, err := k.Clientset.CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})
	if err != nil {
		return container.Container{}, err
	}

	for _, c := range k.podToContainers(ctx, pod) {
		if c.ID == id {
			return c, nil
		}
	}

	return container.Container{}, fmt.Errorf("container %s not found in pod %s", containerName, podName)
}

func (k *K8sClient) ContainerLogs(ctx context.Context, id string, since time.Time, stdType container.StdType) (io.ReadCloser, error) {
	namespace, podName, containerName := parsePodContainerID(id)

	var lines int64 = 500
	opts := &corev1.PodLogOptions{
		Container:  containerName,
		Follow:     true,
		Previous:   false,
		Timestamps: true,
		SinceTime:  &metav1.Time{Time: since},
		TailLines:  &lines,
	}

	return k.Clientset.CoreV1().Pods(namespace).GetLogs(podName, opts).Stream(ctx)
}

View on GitHub (pinned to d9463cbe21)