{"record":{"id":"07e86ab1f91f5db2","repo":"abiosoft/colima","slug":"error-initiating-container-runtime-w","errorCode":null,"errorMessage":"error initiating container runtime: %w","messagePattern":"error initiating container runtime: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/app.go","lineNumber":574,"sourceCode":"\t\tenv, err := c.containerEnvironment(runtime)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcontainers = append(containers, env)\n\t}\n\n\t// detect and add kubernetes\n\tif k, err := c.containerEnvironment(kubernetes.Name); err == nil && k.Running(ctx) {\n\t\tcontainers = append(containers, k)\n\t}\n\n\treturn containers, nil\n}\n\nfunc (c colimaApp) containerEnvironment(runtime string) (environment.Container, error) {\n\tenv, err := environment.NewContainer(runtime, c.guest.Host(), c.guest)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error initiating container runtime: %w\", err)\n\t}\n\tif err := host.IsInstalled(env); err != nil {\n\t\treturn nil, fmt.Errorf(\"dependency check failed for %s: %w\", runtime, err)\n\t}\n\n\treturn env, nil\n}\n\nfunc (c colimaApp) Runtime() (string, error) {\n\treturn c.currentRuntime(context.Background())\n}\n\nfunc (c colimaApp) Kubernetes() (environment.Container, error) {\n\treturn c.containerEnvironment(kubernetes.Name)\n}\n\nfunc (c colimaApp) Active() bool {\n\treturn c.guest.Running(context.Background())","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/app/app.go#L556-L592","documentation":"Returned by colimaApp.containerEnvironment (app/app.go:574) when environment.NewContainer fails to construct a container runtime implementation for the given name. The %w wraps the underlying error, which typically names the unsupported/unknown runtime string. It means the runtime requested (from stored settings or 'kubernetes') cannot be mapped to a registered container implementation in this colima build.","triggerScenarios":"Calling containerEnvironment(runtime) with a runtime string that environment.NewContainer does not recognize: a corrupted settings value, a runtime renamed/removed across colima versions (e.g. containerd/incus availability differs per version), or Kubernetes() with the kubernetes environment unavailable in this build.","commonSituations":"Profile migrated between colima versions with different runtime registries; manually edited ~/.colima/<profile>/colima.yaml with a typo'd runtime; running a stripped-down fork where docker/containerd are not registered.","solutions":["Inspect the wrapped error (%w) — it identifies the offending runtime name","Check the profile settings (colima list -j, or ~/.colima/<profile>/colima.yaml) for an unexpected runtime value","Restart with an explicit supported runtime: `colima start -p <profile> --runtime docker`","If the profile predates the current colima version, `colima delete -p <profile>` and recreate it"],"exampleFix":"// before\nenv, err := c.containerEnvironment(runtime) // runtime from older settings\nif err != nil { return err }\n\n// after\n// validate before constructing\nswitch runtime {\ncase docker.Name, containerd.Name:\n    // known runtimes\n\ndefault:\n    return fmt.Errorf(\"unsupported runtime '%s', recreate the profile with `colima start --runtime docker`\", runtime)\n}\nenv, err := c.containerEnvironment(runtime)","handlingStrategy":"validation","validationCode":"// Validate the runtime string against supported values before constructing\nvar supported = map[string]bool{\n    \"docker\": true, \"containerd\": true,\n}\nif !supported[runtime] {\n    return fmt.Errorf(\"unsupported runtime '%s'; use docker or containerd\", runtime)\n}\nenv, err := c.containerEnvironment(runtime)","typeGuard":null,"tryCatchPattern":"if _, err := c.containerEnvironment(runtime); err != nil {\n    if strings.HasPrefix(err.Error(), \"error initiating container runtime\") {\n        // runtime name unknown to this build: recreate profile with a supported runtime\n    }\n    return err\n}","preventionTips":["Pin an explicit runtime at profile creation: `colima start --runtime docker`","Avoid hand-editing the runtime field in ~/.colima/<profile>/colima.yaml","After colima version upgrades, verify `colima list` still recognizes the profile's runtime before updating"],"tags":["runtime","container","docker","containerd","go"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}