JanDeDobbeleer/oh-my-posh · warning
YTMDA token not found, please authenticate using `oh-my-posh
Error message
YTMDA token not found, please authenticate using `oh-my-posh auth ytmda`
What it means
The ytm segment (YouTube Music Desktop App) requires an auth token cached under the key auth.YTMDATOKEN, obtained via `oh-my-posh auth ytmda`. setStatus throws this error when the cache has no token or the stored string is empty, meaning the user never authenticated or the token was cleared.
Source
Thrown at src/segments/ytm.go:51
return err == nil
}
type ytmdaStatusResponse struct {
Video struct {
Author string `json:"author"`
Title string `json:"title"`
} `json:"video"`
Player struct {
TrackState int `json:"trackState"`
AdPlaying bool `json:"adPlaying"`
} `json:"player"`
}
func (y *Ytm) setStatus() error {
token, OK := cache.Device.Get[string](auth.YTMDATOKEN)
if !OK || token == "" {
return errors.New("YTMDA token not found, please authenticate using `oh-my-posh auth ytmda`")
}
status, err := y.requestStatus(token)
if err != nil {
return err
}
switch status.Player.TrackState {
case 1, 2: // playing or buffering
y.Status = playing
y.Icon = y.options.String(PlayingIcon, "\uf04b ")
case -1: // stopped
y.Status = stopped
y.Icon = y.options.String(StoppedIcon, "\uf04d ")
default: // paused
y.Status = paused
y.Icon = y.options.String(PausedIcon, "\uf04c ")
}View on GitHub (pinned to 0976794618)
Solutions
- Run `oh-my-posh auth ytmda` to authenticate and store the token
- Ensure YTMDA (YouTube Music Desktop App) is installed and its API is enabled
- Remove/disable the ytm segment from the prompt config if not using YTMDA
- Check that the oh-my-posh device cache persists between sessions (not wiped on reboot)
- If auth was run, clear cache and re-authenticate to refresh a stale token
Example fix
// before: shell config renders ytm segment without token
{ type = "ytm" ... }
// after: run once first
oh-my-posh auth ytmda Defensive patterns
Strategy: validation
Validate before calling
// before enabling the segment, check for the token
if _, ok := cache.Device.Get[string](auth.YTMDATOKEN); !ok {
// prompt the user: oh-my-posh auth ytmda
} Try / catch
token, OK := cache.Device.Get[string](auth.YTMDATOKEN)
if !OK || token == "" {
return errTokenMissing // segment hides itself instead of failing the prompt
} Prevention
- Run `oh-my-posh auth ytmda` once per machine after installing YTMDA
- Re-authenticate whenever YTMDA is reinstalled
- Remove the ytm segment from configs on machines without YTMDA
- Avoid wiping the device cache between sessions
When it happens
Trigger: Enabled calls setStatus; cache.Device.Get[string](auth.YTMDATOKEN) returns OK=false (key absent) or an empty string. Happens on any machine/profile where `oh-my-posh auth ytmda` was never run or its cache was wiped.
Common situations: Fresh install or new machine; cache directory cleaned/deleted; token cleared after YTMDA re-install; running the prompt with the ytm segment enabled in the config but never completing the auth flow.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- no connections found
- invalid yaml
- no current context
- azure config dir not found
- missing Brewfather user id (user_id)
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/9ef4c897ad181cff.
Report an issue: GitHub.