{"record":{"id":"770690bab81823e2","repo":"JanDeDobbeleer/oh-my-posh","slug":"d-is-not-a-valid-game-status","errorCode":null,"errorMessage":"%d is not a valid game status","messagePattern":"(.+?) is not a valid game status","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/segments/nba.go","lineNumber":294,"sourceCode":"\n\treturn nil, err\n}\n\nfunc (nba *Nba) getResult() (*NBAData, error) {\n\tteamName := nba.options.String(TeamName, \"\")\n\n\thttpTimeout := nba.options.Int(options.HTTPTimeout, options.DefaultHTTPTimeout)\n\n\tlog.Debug(\"fetching available data for \" + teamName)\n\n\tdata, err := nba.getAvailableGameData(teamName, httpTimeout)\n\tif err != nil {\n\t\tlog.Error(errors.Join(err, fmt.Errorf(\"unable to get data for team %s\", teamName)))\n\t\treturn nil, err\n\t}\n\n\tif !data.GameStatus.Valid() {\n\t\terr := fmt.Errorf(\"%d is not a valid game status\", data.GameStatus)\n\t\tlog.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}\n","sourceCodeStart":276,"sourceCodeEnd":301,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/nba.go#L276-L301","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check what game status the API returns for your team (curl the endpoint) and compare with the Valid() set in the segment source","Update oh-my-posh — newer versions often extend accepted game statuses after API changes","Hide the NBA segment when no games are scheduled (disable it or scope it to game days)","File an issue upstream if the API introduced a status the segment should accept"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// inspect the API payload's gameStatus before trusting it\ntype payload struct { GameStatus int `json:\"gameStatus\"` }\nvar p payload\njson.Unmarshal(body, &p)\nvalid := []int{1,2,3,4} // accepted statuses\nslices.Contains(valid, p.GameStatus) // else hide segment","typeGuard":"func validGameStatus(s int) bool {\n    switch s {\n    case 1, 2, 3, 4:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Hide the segment during off-season / no-game days","Update oh-my-posh after stats API schema changes","Log the raw payload when statuses look unexpected","Report new upstream status codes to the project"],"tags":["go","api","validation","segment","data-contract"],"backgroundTag":"unexpected-api-value","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}