{"record":{"id":"6e88c4674e3dc7d4","repo":"docker/cli","slug":"failed-to-list-tls-files-for-context-s-w","errorCode":null,"errorMessage":"failed to list TLS files for context %s: %w","messagePattern":"failed to list TLS files for context (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/context/store/tlsstore.go","lineNumber":70,"sourceCode":"\t}\n\treturn nil\n}\n\nfunc (s *tlsStore) removeEndpoint(name, endpointName string) error {\n\tif err := os.RemoveAll(s.endpointDir(name, endpointName)); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove TLS data for endpoint %s: %w\", endpointName, err)\n\t}\n\treturn nil\n}\n\nfunc (s *tlsStore) listContextData(name string) (map[string]EndpointFiles, error) {\n\tcontextDir := s.contextDir(name)\n\tepFSs, err := os.ReadDir(contextDir)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn map[string]EndpointFiles{}, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to list TLS files for context %s: %w\", name, err)\n\t}\n\tr := make(map[string]EndpointFiles)\n\tfor _, epFS := range epFSs {\n\t\tif epFS.IsDir() {\n\t\t\tfss, err := os.ReadDir(filepath.Join(contextDir, epFS.Name()))\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to list TLS files for endpoint %s: %w\", epFS.Name(), err)\n\t\t\t}\n\t\t\tvar files EndpointFiles\n\t\t\tfor _, fs := range fss {\n\t\t\t\tif !fs.IsDir() {\n\t\t\t\t\tfiles = append(files, fs.Name())\n\t\t\t\t}\n\t\t\t}\n\t\t\tr[epFS.Name()] = files","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/context/store/tlsstore.go#L52-L88","documentation":"Returned by ContextStore.ListTLSFiles / tlsStore.listContextData when os.ReadDir of the context's TLS dir fails for a reason other than not-exist (not-exist returns an empty map). The dir exists but cannot be read.","triggerScenarios":"Calling ListTLSFiles(ctx) when the TLS dir exists but is unreadable: permission denied, I/O error, or the path became invalid mid-operation.","commonSituations":"Permission denied on the TLS dir (owned by another user); corrupted filesystem; permission reset after restore.","solutions":["Fix permissions on the context's TLS dir ~/.docker/contexts/tls/<hash>.","Recreate the context's TLS material if the dir is damaged.","Confirm the running user has read/execute on the directory."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"files, err := store.ListTLSFiles(ctx)\nif err != nil {\n    var perr *os.PathError\n    if errors.As(err, &perr) && errors.Is(perr.Err, os.ErrPermission) {\n        // fix read/execute perms on the tls dir, then retry\n    }\n    return err\n}","preventionTips":["Ensure read+execute permissions on the context's tls dir for the running user.","Don't let backup/restore reset TLS dir permissions.","Fall back to GetStorageInfo to inspect paths when listing fails."],"tags":["context","tls","filesystem","permissions","list"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}