{"record":{"id":"9c3698132180a89d","repo":"jesseduffield/lazydocker","slug":"expected-docker-endpointmeta-got-t","errorCode":null,"errorMessage":"expected docker.EndpointMeta, got %T","messagePattern":"expected docker\\.EndpointMeta, got %T","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/commands/docker.go","lineNumber":571,"sourceCode":"\t}\n\n\tstoreConfig := ctxstore.NewConfig(\n\t\tfunc() interface{} { return &ddocker.EndpointMeta{} },\n\t\tctxstore.EndpointTypeGetter(ddocker.DockerEndpoint, func() interface{} { return &ddocker.EndpointMeta{} }),\n\t)\n\n\tst := ctxstore.New(cliconfig.ContextStoreDir(), storeConfig)\n\tmd, err := st.GetMetadata(currentContext)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdockerEP, ok := md.Endpoints[ddocker.DockerEndpoint]\n\tif !ok {\n\t\treturn \"\", err\n\t}\n\tdockerEPMeta, ok := dockerEP.(ddocker.EndpointMeta)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"expected docker.EndpointMeta, got %T\", dockerEP)\n\t}\n\n\tif dockerEPMeta.Host != \"\" {\n\t\treturn dockerEPMeta.Host, nil\n\t}\n\n\t// We might end up here, if the context was created with the `host` set to an empty value (i.e. '').\n\t// For example:\n\t// ```sh\n\t// docker context create foo --docker \"host=\"\n\t// ```\n\t// In such scenario, we mimic the `docker` cli and try to connect to the \"default docker host\".\n\treturn defaultDockerHost, nil\n}\n","sourceCodeStart":553,"sourceCodeEnd":586,"githubUrl":"https://github.com/jesseduffield/lazydocker/blob/7e7aadc2071d58031bf2daafca1fbd4093efc23f/pkg/commands/docker.go#L553-L586","documentation":"In getEndpointHostFromContext (docker.go), after loading metadata for the current docker context, the endpoint entry under docker.DockerEndpoint is type-asserted to ddocker.EndpointMeta. If the CLI stored a different concrete type in the context store (the docker CLI has several endpoint metadata implementations), the assertion fails and this error reports the actual %T. It means the context exists but its shape is one lazydocker does not understand.","triggerScenarios":"Starting lazydocker with DOCKER_HOST unset and the active docker context created by a tool or CLI version that writes a non-standard endpoint metadata type into the context store (e.g. contexts with additional endpoint plugins or different metadata structs).","commonSituations":"Contexts created/modified by docker desktop, test frameworks, or context orchestrators; mixed docker CLI versions on one machine (older/newer context store schema); contexts where the docker endpoint key holds a nil or plugin-specific value.","solutions":["Switch to a plain context: `docker context use default` (or recreate with `docker context create foo --docker host=ssh://user@host`) so the store holds the standard EndpointMeta.","Upgrade/downgrade so lazydocker and the docker CLI agree on context store schema — reinstall the same Docker version that created the contexts.","Inspect the store: `docker context ls` and check ~/.docker/contexts/meta/*/meta.json to see what is stored; recreate any context whose docker endpoint looks unusual.","As a workaround set DOCKER_HOST explicitly, which avoids context metadata lookup entirely."],"exampleFix":"# before\ndocker context use weird-tool-context   # non-standard metadata\nlazydocker                              # 'expected docker.EndpointMeta, got ...'\n\n# after\ndocker context use default\nlazydocker\n# or: DOCKER_HOST=ssh://user@host lazydocker","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"dockerEPMeta, ok := dockerEP.(ddocker.EndpointMeta)\nif !ok {\n    // fall back to default host instead of failing hard\n    return defaultDockerHost(), nil\n}","tryCatchPattern":"host, err := getEndpointHostFromContext()\nif err != nil && strings.Contains(err.Error(), \"expected docker.EndpointMeta\") {\n    host = \"unix:///var/run/docker.sock\" // sensible default\n}","preventionTips":["Create docker contexts with the standard CLI (`docker context create ... --docker host=...`) so metadata stays EndpointMeta-shaped.","Keep docker CLI and lazydocker versions roughly in sync to avoid context-store schema drift.","Set DOCKER_HOST explicitly to bypass context metadata entirely in automation."],"tags":["docker","docker-context","type-assertion","version-mismatch"],"backgroundTag":null,"analyzedSha":"7e7aadc2071d58031bf2daafca1fbd4093efc23f","analyzedAt":"2026-08-15T09:51:48.093Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}