{"record":{"id":"5e17f6de7c62b825","repo":"slimtoolkit/slim","slug":"unknown-container-type","errorCode":null,"errorMessage":"unknown container type","messagePattern":"unknown container type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/command/debug/handle_kubernetes_runtime.go","lineNumber":1032,"sourceCode":"\n\tisContainerRunning := func() (bool, error) {\n\t\tpod, err := api.CoreV1().Pods(nsName).Get(ctx, podName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tswitch pod.Status.Phase {\n\t\tcase corev1.PodRunning:\n\t\t\tvar statuses []corev1.ContainerStatus\n\t\t\tswitch containerType {\n\t\t\tcase ctInit:\n\t\t\t\tstatuses = pod.Status.InitContainerStatuses\n\t\t\tcase ctStandard:\n\t\t\t\tstatuses = pod.Status.ContainerStatuses\n\t\t\tcase ctEphemeral:\n\t\t\t\tstatuses = pod.Status.EphemeralContainerStatuses\n\t\t\tdefault:\n\t\t\t\treturn false, fmt.Errorf(\"unknown container type\")\n\t\t\t}\n\n\t\t\tlogger.Tracef(\"waitForContainer: statuses (%d)\", len(statuses))\n\t\t\tfor _, status := range statuses {\n\t\t\t\tif status.Name == containerName {\n\t\t\t\t\tif status.State.Running != nil {\n\t\t\t\t\t\tlogger.Tracef(\"waitForContainer: RUNNING - %s/%s/%s[%s]\", nsName, podName, containerName, containerType)\n\n\t\t\t\t\t\tif xc != nil {\n\t\t\t\t\t\t\txc.Out.Info(\"wait.for.container.done\",\n\t\t\t\t\t\t\t\tovars{\n\t\t\t\t\t\t\t\t\t\"state\":      \"RUNNING\",\n\t\t\t\t\t\t\t\t\t\"name\":       containerName,\n\t\t\t\t\t\t\t\t\t\"pod\":        podName,\n\t\t\t\t\t\t\t\t\t\"namespace\":  nsName,\n\t\t\t\t\t\t\t\t\t\"type\":       containerType,\n\t\t\t\t\t\t\t\t\t\"start_time\": fmt.Sprintf(\"%v\", status.State.Running.StartedAt),\n\t\t\t\t\t\t\t\t\t\"id\":         status.ContainerID,","sourceCodeStart":1014,"sourceCodeEnd":1050,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/command/debug/handle_kubernetes_runtime.go#L1014-L1050","documentation":"waitForContainer polls container statuses by type: init, standard, or ephemeral. The switch over the container type has no matching case, so it fails with 'unknown container type'. This is an internal invariant violation — the container type value was not one of ctInit/ctStandard/ctEphemeral.","triggerScenarios":"HandleKubernetesRuntime's waitForContainer helper receives a container type outside the known enum (e.g., zero-value or corrupted parameter) while waiting for a container to reach Running state.","commonSituations":"A new container type constant added to the codebase without extending waitForContainer's switch; a refactor that changed the type values; passing an unset/empty container-type variable.","solutions":["Update to the latest docker-slim version; if a recent release introduced a new container type, this may already be patched.","Re-run the command to rule out a transient bad state; if reproducible, file a bug with the exact command and k8s setup.","As a workaround, specify the target container explicitly so the code path takes a known container type.","Inspect the source switch (handle_kubernetes_runtime.go:~1025) and extend it to handle the new type if you build from source."],"exampleFix":"// before\ncase ctEphemeral:\n    statuses = pod.Status.EphemeralContainerStatuses\ndefault:\n    return false, fmt.Errorf(\"unknown container type\")\n// after\ncase ctEphemeral:\n    statuses = pod.Status.EphemeralContainerStatuses\ncase ctNewType:\n    statuses = pod.Status.ContainerStatuses\ndefault:\n    return false, fmt.Errorf(\"unknown container type: %v\", ct)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runDebug(target); err != nil && strings.Contains(err.Error(), \"unknown container type\") {\n    // internal bug: report to docker-slim with command + version; pin to a known-good release\n}","preventionTips":["Keep docker-slim updated to the latest release","If building from source, extend waitForContainer's switch for any new container-type constant","File an issue with repro steps when this appears on a stock release"],"tags":["kubernetes","internal","container-type"],"backgroundTag":"invalid-enum-value","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}