{"record":{"id":"6187783bfd663352","repo":"slimtoolkit/slim","slug":"slim-error-no-network-info","errorCode":null,"errorMessage":"slim: error => no network info","messagePattern":"slim: error => no network info","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/inspectors/container/container_inspector.go","lineNumber":747,"sourceCode":"\t\t\tlogger.Fatalf(\"[SIGMON] received SIGINT, killing container %s\", i.ContainerID)\n\t\tcase <-i.dockerEventStopCh:\n\t\t\tlogger.Debug(\"[SIGMON] Docker event monitor stopped\")\n\t\t\t//not killing target because we are going through a graceful shutdown\n\t\t\t//where we sent the StopMonitor and ShutdownSensor ipc commands\n\t\t}\n\t}()\n\n\tif err := i.APIClient.StartContainer(i.ContainerID, nil); err != nil {\n\t\treturn err\n\t}\n\n\tinspectContainerOpts := dockerapi.InspectContainerOptions{ID: i.ContainerID, Size: true}\n\tif i.ContainerInfo, err = i.APIClient.InspectContainerWithOptions(inspectContainerOpts); err != nil {\n\t\treturn err\n\t}\n\n\tif i.ContainerInfo.NetworkSettings == nil {\n\t\treturn fmt.Errorf(\"slim: error => no network info\")\n\t}\n\n\tif hCfg := i.ContainerInfo.HostConfig; hCfg != nil && !i.isHostNetworked() {\n\t\tlogger.Debugf(\"container HostConfig.NetworkMode => %s len(ports)=%d\",\n\t\t\thCfg.NetworkMode, len(i.ContainerInfo.NetworkSettings.Ports))\n\n\t\tif len(i.ContainerInfo.NetworkSettings.Ports) < len(commsExposedPorts) {\n\t\t\treturn fmt.Errorf(\"slim: error => missing comms ports\")\n\t\t}\n\t}\n\n\tlogger.Debugf(\"container NetworkSettings.Ports => %#v\", i.ContainerInfo.NetworkSettings.Ports)\n\n\ti.setAvailablePorts(hostProbePorts)\n\n\tif i.PrintState {\n\t\ti.xc.Out.Info(\"container\",\n\t\t\tovars{","sourceCodeStart":729,"sourceCodeEnd":765,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/inspectors/container/container_inspector.go#L729-L765","documentation":"During container inspection in docker-slim's container inspector, the Docker Engine's inspect response came back without a NetworkSettings object. docker-slim requires network metadata to wire probes and expose ports, so it aborts rather than proceed with incomplete container info. This indicates an anomalous or stale inspect result rather than a normal user error.","triggerScenarios":"Calling RunContainer when the Docker API InspectContainerWithOptions succeeds but returns a ContainerInfo whose NetworkSettings field is nil — e.g. inspecting a container that was just removed, a daemon returning a degraded response, or an unexpected API version quirk.","commonSituations":"Running slim against a container that was concurrently deleted by another process; very old or very new Docker API versions changing response shape; resource pressure on the daemon producing partial inspect payloads.","solutions":["Verify the container exists and was not removed mid-run: docker inspect <container-id>.","Update Docker Engine and docker-slim to matched, current versions.","Re-run the slim command; if it recurs, capture daemon logs and file an issue.","Ensure the Docker API client/server version negotiation is not pinning an incompatible API version."],"exampleFix":"// before: proceeding blindly\ninfo, _ := client.InspectContainerWithOptions(opts)\nuse(info.NetworkSettings.Ports)\n// after: guard like the inspector does\ninfo, err := client.InspectContainerWithOptions(opts)\nif err != nil { return err }\nif info.NetworkSettings == nil {\n    return fmt.Errorf(\"slim: error => no network info\")\n}","handlingStrategy":"try-catch","validationCode":"info, err := client.InspectContainerWithOptions(opts)\nif err == nil && info.NetworkSettings == nil {\n    // inspect the container again / verify it exists before proceeding\n    _, err = client.InspectContainerWithOptions(opts)\n}","typeGuard":"func hasNetworkSettings(info *dockertypes.ContainerJSON) bool {\n    return info != nil && info.NetworkSettings != nil\n}","tryCatchPattern":"if err := runSlimContainer(...); err != nil {\n    if strings.Contains(err.Error(), \"no network info\") {\n        // re-check container exists, then retry once\n        return retryOrInspectManually(containerID)\n    }\n    return err\n}","preventionTips":["Confirm the container is running and not deleted concurrently before running slim.","Keep Docker Engine and docker-slim versions current and matched.","Avoid parallel tooling that removes/renames the target container during a slim run."],"tags":["docker","inspection","network"],"backgroundTag":"docker-inspect-missing-network-settings","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}