{"record":{"id":"5637cdc272f77858","repo":"docker/cli","slug":"tls-data-for-s-s-s-does-not-exist-5637cd","errorCode":null,"errorMessage":"TLS data for %s/%s/%s does not exist","messagePattern":"TLS data for (.+?)/(.+?)/(.+?) does not exist","errorType":"exception","errorClass":"notFoundErr","httpStatus":null,"severity":"error","filePath":"cli/context/store/tlsstore.go","lineNumber":41,"sourceCode":"}\n\nfunc (s *tlsStore) createOrUpdate(name, endpointName, filename string, data []byte) error {\n\tparentOfRoot := filepath.Dir(s.root)\n\tif err := os.MkdirAll(parentOfRoot, 0o755); err != nil {\n\t\treturn err\n\t}\n\tendpointDir := s.endpointDir(name, endpointName)\n\tif err := os.MkdirAll(endpointDir, 0o700); err != nil {\n\t\treturn err\n\t}\n\treturn atomicwriter.WriteFile(filepath.Join(endpointDir, filename), data, 0o600)\n}\n\nfunc (s *tlsStore) getData(name, endpointName, filename string) ([]byte, error) {\n\tdata, err := os.ReadFile(filepath.Join(s.endpointDir(name, endpointName), filename))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, notFound(fmt.Errorf(\"TLS data for %s/%s/%s does not exist\", name, endpointName, filename))\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to read TLS data for endpoint %s: %w\", endpointName, err)\n\t}\n\treturn data, nil\n}\n\n// remove deletes all TLS data for the given context.\nfunc (s *tlsStore) remove(name string) error {\n\tif err := os.RemoveAll(s.contextDir(name)); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove TLS data: %w\", err)\n\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}","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/context/store/tlsstore.go#L23-L59","documentation":"Returned as an errdefs NotFound error by ContextStore.GetTLSData / tlsStore.getData when the requested file (e.g. ca.pem, cert.pem, key.pem) does not exist for the given context/endpoint. The notFound() wrapper makes it satisfy errdefs.IsNotFound.","triggerScenarios":"Calling store.GetTLSData(ctx, endpoint, file) for a context that has no TLS material stored, or where that specific file was never written. The endpoint dir or the file is absent.","commonSituations":"Querying TLS for a context that uses plain TCP / no TLS; referencing a filename (e.g. 'cert.pem') that was never imported; after partial cleanup removed some TLS files.","solutions":["Call store.ListTLSFiles(ctx) first to see which files actually exist before fetching a specific one.","If TLS is expected, (re)import the TLS material into the context.","Treat the NotFound case as 'no TLS configured' when that is a valid state for your flow."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// List TLS files before fetching a specific one.\nfiles, err := store.ListTLSFiles(ctxName)\nif err != nil { return err }\nfor ep, fs := range files {\n    for _, f := range fs {\n        // f exists and is safe to GetTLSData\n    }\n}","typeGuard":null,"tryCatchPattern":"data, err := store.GetTLSData(ctx, ep, \"ca.pem\")\nif err != nil {\n    if errors.Is(err, errdefs.ErrNotFound) {\n        // no CA configured for this endpoint — proceed without it\n    }\n}","preventionTips":["Treat a missing TLS file as 'no TLS' when that is a valid configuration.","Use ListTLSFiles to discover what is actually stored before fetching by name.","Re-import TLS material after partial cleanup."],"tags":["context","tls","not-found","certificates"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}