{"record":{"id":"d2b42355044c07b5","repo":"JanDeDobbeleer/oh-my-posh","slug":"no-current-context","errorCode":null,"errorMessage":"no current context","messagePattern":"no current context","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/segments/argocd.go","lineNumber":101,"sourceCode":"\tvar data ArgocdConfig\n\terr := yaml.Unmarshal([]byte(config), &data)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn false, errors.New(argocdInvalidYaml)\n\t}\n\ta.Name = data.CurrentContext\n\tfor _, context := range data.Contexts {\n\t\tif context.Name == a.Name {\n\t\t\t// mandatory fields in yaml\n\t\t\tif context.Server == \"\" || context.User == \"\" {\n\t\t\t\treturn false, errors.New(argocdInvalidYaml)\n\t\t\t}\n\t\t\ta.Server = context.Server\n\t\t\ta.User = context.User\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, errors.New(argocdNoCurrent)\n}\n","sourceCodeStart":83,"sourceCodeEnd":103,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/argocd.go#L83-L103","documentation":"The argocd config parsed fine, but no entry in the contexts list matches `current-context`. parseConfig iterates all contexts looking for one whose name equals data.CurrentContext; when the loop completes without a match it returns 'no current context' and the segment disables itself.","triggerScenarios":"The YAML contains `current-context: <name>` but no context with that exact name (typo, context removed, or contexts list empty) under the `contexts:` key.","commonSituations":"Deleting a context's entry while current-context still references it; renaming a context without updating current-context; writing the config by hand and forgetting the contexts list entirely.","solutions":["Run `argocd context <existing-name>` (or `argocd login`) so the CLI repairs current-context to point at a real entry.","Edit the file so the context name exactly matches current-context, remembering the `name:` field must live under the context entry.","If no contexts are needed on this machine, disable the argocd segment in the theme instead of keeping a broken config."],"exampleFix":"# before\ncontexts:\n  - name: staging\n    server: https://staging.example.com\n    user: me\ncurrent-context: prod\n\n# after\ncontexts:\n  - name: prod\n    server: https://prod.example.com\n    user: me\ncurrent-context: prod","handlingStrategy":"validation","validationCode":"argocd context list   # verify current-context names an entry that exists","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After removing/renaming a context, always update current-context (`argocd context <name>`)","Keep the `name:` of at least one context identical to `current-context`","Let the argocd CLI manage the file to avoid drift between the two fields"],"tags":["argocd","config-file","segment"],"backgroundTag":"current-context-missing","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}