{"id":"2049b008c9e72a4f","repo":"docker/cli","slug":"context-q-already-exists","errorCode":null,"errorMessage":"context %q already exists","messagePattern":"context %q already exists","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/context/create.go","lineNumber":127,"sourceCode":"\t}\n\tif err := validateEndpoints(contextMetadata); err != nil {\n\t\treturn err\n\t}\n\tif err := contextStore.CreateOrUpdate(contextMetadata); err != nil {\n\t\treturn err\n\t}\n\treturn contextStore.ResetTLSMaterial(name, &contextTLSData)\n}\n\nfunc checkContextNameForCreation(s store.Reader, name string) error {\n\tif err := store.ValidateContextName(name); err != nil {\n\t\treturn err\n\t}\n\tif _, err := s.GetMetadata(name); !errdefs.IsNotFound(err) {\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error while getting existing contexts: %w\", err)\n\t\t}\n\t\treturn fmt.Errorf(\"context %q already exists\", name)\n\t}\n\treturn nil\n}\n\nfunc createFromExistingContext(s store.ReaderWriter, name string, fromContextName string, opts createOptions) error {\n\tif len(opts.endpoint) != 0 {\n\t\treturn errors.New(\"cannot use --docker flag when --from is set\")\n\t}\n\treader := store.Export(fromContextName, &descriptionDecorator{\n\t\tReader:      s,\n\t\tdescription: opts.description,\n\t})\n\tdefer reader.Close()\n\treturn store.Import(name, s, reader)\n}\n\ntype descriptionDecorator struct {\n\tstore.Reader","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/context/create.go#L109-L145","documentation":"Error \"context %q already exists\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/context/create.go:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}