JanDeDobbeleer/oh-my-posh · info
no current context
Error message
no current context
What it means
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.
Source
Thrown at src/segments/argocd.go:101
var data ArgocdConfig
err := yaml.Unmarshal([]byte(config), &data)
if err != nil {
log.Error(err)
return false, errors.New(argocdInvalidYaml)
}
a.Name = data.CurrentContext
for _, context := range data.Contexts {
if context.Name == a.Name {
// mandatory fields in yaml
if context.Server == "" || context.User == "" {
return false, errors.New(argocdInvalidYaml)
}
a.Server = context.Server
a.User = context.User
return true, nil
}
}
return false, errors.New(argocdNoCurrent)
}
View on GitHub (pinned to 0976794618)
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.
Example fix
# before
contexts:
- name: staging
server: https://staging.example.com
user: me
current-context: prod
# after
contexts:
- name: prod
server: https://prod.example.com
user: me
current-context: prod Defensive patterns
Strategy: validation
Validate before calling
argocd context list # verify current-context names an entry that exists
Prevention
- 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
When it happens
Trigger: The YAML contains `current-context: <name>` but no context with that exact name (typo, context removed, or contexts list empty) under the `contexts:` key.
Common situations: 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.
Related errors
- invalid yaml
- azure config dir not found
- no connections found
- missing Brewfather user id (user_id)
- NO ACTIVE CONFIG FOUND
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/d2b42355044c07b5.
Report an issue: GitHub.