{"record":{"id":"bfd4489d3a386d43","repo":"abiosoft/colima","slug":"error-inspecting-containers-w","errorCode":null,"errorMessage":"error inspecting containers: %w","messagePattern":"error inspecting containers: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"daemon/process/inotify/volumes.go","lineNumber":116,"sourceCode":"\t\t}\n\t}\n\n\tlog.Tracef(\"found containers %+v\", containers)\n\n\t// fetch volumes\n\tvar resp []struct {\n\t\tMounts []struct {\n\t\t\tSource string `json:\"Source\"`\n\t\t} `json:\"Mounts\"`\n\t}\n\t{\n\t\targs := append([]string{}, cmdArgs...)\n\t\targs = append(args, \"inspect\")\n\t\targs = append(args, containers...)\n\n\t\tvar buf bytes.Buffer\n\t\tif err := f.guest.RunWith(nil, &buf, args...); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error inspecting containers: %w\", err)\n\t\t}\n\t\tif err := json.NewDecoder(&buf).Decode(&resp); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error decoding docker response\")\n\t\t}\n\t}\n\n\t// process and discard redundant volumes\n\tvols := []string{}\n\t{\n\t\tshouldMount := func(child string) bool {\n\t\t\t// ignore all invalid directories.\n\t\t\t// i.e. directories not within the mounted VM directories\n\t\t\tfor _, parent := range f.vmVols {\n\t\t\t\tif strings.HasPrefix(child, parent) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/daemon/process/inotify/volumes.go#L98-L134","documentation":"fetchVolumes then runs `<runtime> inspect <id...>` for every id obtained from `ps -q`; failure wraps as 'error inspecting containers'. The classic cause is a race: a container that was running at ps time exits and is removed before inspect runs, making inspect return an error for a now-missing id.","triggerScenarios":"short-lived containers exiting between the ps and inspect calls; very large container counts producing oversized argument lists; runtime-level inspect errors in the guest.","commonSituations":"CI-style churn workloads with many ephemeral containers; batch jobs spawning and removing containers while inotify watching is enabled.","solutions":["wait for the next poll — churn races heal once the workload settles","reproduce manually to see the runtime's complaint: `colima ssh -- docker ps -q | head | xargs docker inspect`","restart colima if the error floods logs continuously and watching never engages"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := guest.RunWith(nil, &buf, args...); err != nil {\n    // most often a ps/inspect race with exiting containers — drop this cycle,\n    // the 5s poll rebuilds the container list from scratch next time\n    return nil, fmt.Errorf(\"error inspecting containers: %w\", err)\n}","preventionTips":["expect races under high container churn; the poll self-heals","reduce unnecessary container churn while inotify watching is active","batch-inspect manually in the guest to confirm when it is churn vs a stuck runtime"],"tags":["docker","inspect","race-condition","transient"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}