JanDeDobbeleer/oh-my-posh · warning
unable to get data for team %s
Error message
unable to get data for team %s
What it means
The NBA segment fetches available game data for a team from the NHL/NBA stats API. If the HTTP request fails, 'unable to get data for team <team>' is logged (joined with the underlying error) and the raw error is returned, disabling the segment.
Source
Thrown at src/segments/nba.go:289
// If the score endpoint doesn't have anything get data from the schedule endpoint
data, err = nba.retrieveScheduleData(teamName, httpTimeout)
if err == nil {
return data, nil
}
return nil, err
}
func (nba *Nba) getResult() (*NBAData, error) {
teamName := nba.options.String(TeamName, "")
httpTimeout := nba.options.Int(options.HTTPTimeout, options.DefaultHTTPTimeout)
log.Debug("fetching available data for " + teamName)
data, err := nba.getAvailableGameData(teamName, httpTimeout)
if err != nil {
log.Error(errors.Join(err, fmt.Errorf("unable to get data for team %s", teamName)))
return nil, err
}
if !data.GameStatus.Valid() {
err := fmt.Errorf("%d is not a valid game status", data.GameStatus)
log.Error(err)
return nil, err
}
return data, nil
}
View on GitHub (pinned to 0976794618)
Solutions
- Verify network access to the stats API endpoint and any proxy settings
- Check the team name/abbreviation in the segment config is valid
- Increase the segment's HTTP timeout option if the API is slow
- Hide the segment when offline or accept it disappearing; consider a template/enable fallback
Example fix
// before
"nba": { "team": "LAL", "http_timeout": 500 }
// after: give the API more time
"nba": { "team": "Lakers", "http_timeout": 2000 } Defensive patterns
Strategy: retry
Validate before calling
// preflight the API before rendering
resp, err := http.Get("https://statsapi.web.nhl.com/api/v1/teams/LAL")
if err != nil || resp.StatusCode != 200 { /* hide segment */ } Try / catch
// segment returns (nil, err); treat as 'no data this prompt'
result, err := getResult(team)
if err != nil {
// fall back to last-known data or hide the segment
} Prevention
- Increase http_timeout on slow networks
- Handle offline states by hiding network segments
- Watch for upstream stats API deprecations
- Validate team names/abbreviations in config
When it happens
Trigger: Rendering an NBA/NHL segment when getAvailableGameData fails: no network connectivity, the stats API being down or rate-limiting, an invalid/unsupported team name in the config, or the configured HTTP timeout expiring.
Common situations: Corporate proxy or firewall blocking the stats API; API endpoint changed/retired upstream; typo'd team name/abbreviation in the theme config; offline laptop triggering the segment on every prompt.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Withings API error: <status>
- %d is not a valid game status
- failed to parse Fajr time: %w
- failed to parse Iftar time: %w
- failed to parse Imsak time: %w
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/f29b6b6dcf8dc6a5.
Report an issue: GitHub.