JanDeDobbeleer/oh-my-posh · warning

%d is not a valid game status

Error message

%d is not a valid game status

What it means

After a successful fetch, the NBA segment validates the game status field returned by the API. If data.GameStatus fails its Valid() check, the segment logs '%d is not a valid game status' and returns an error, so the segment renders nothing.

Source

Thrown at src/segments/nba.go:294

	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

  1. Check what game status the API returns for your team (curl the endpoint) and compare with the Valid() set in the segment source
  2. Update oh-my-posh — newer versions often extend accepted game statuses after API changes
  3. Hide the NBA segment when no games are scheduled (disable it or scope it to game days)
  4. File an issue upstream if the API introduced a status the segment should accept
Defensive patterns

Strategy: fallback

Validate before calling

// inspect the API payload's gameStatus before trusting it
type payload struct { GameStatus int `json:"gameStatus"` }
var p payload
json.Unmarshal(body, &p)
valid := []int{1,2,3,4} // accepted statuses
slices.Contains(valid, p.GameStatus) // else hide segment

Type guard

func validGameStatus(s int) bool {
    switch s {
    case 1, 2, 3, 4:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: The stats API returns a GameStatus value outside the set the segment recognizes — typically because the API schema changed, the response is a placeholder/empty payload (no games scheduled), or a cached/error body was parsed as valid JSON.

Common situations: Off-season or pre-season responses with unexpected status codes; upstream API version bump introducing new status values; team with no scheduled games returning default status 0/8.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/770690bab81823e2. Report an issue: GitHub.