{"record":{"id":"f29b6b6dcf8dc6a5","repo":"JanDeDobbeleer/oh-my-posh","slug":"unable-to-get-data-for-team-s","errorCode":null,"errorMessage":"unable to get data for team %s","messagePattern":"unable to get data for team (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/segments/nba.go","lineNumber":289,"sourceCode":"\t// If the score endpoint doesn't have anything get data from the schedule endpoint\n\tdata, err = nba.retrieveScheduleData(teamName, httpTimeout)\n\tif err == nil {\n\t\treturn data, nil\n\t}\n\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":271,"sourceCodeEnd":301,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/nba.go#L271-L301","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n\"nba\": { \"team\": \"LAL\", \"http_timeout\": 500 }\n// after: give the API more time\n\"nba\": { \"team\": \"Lakers\", \"http_timeout\": 2000 }","handlingStrategy":"retry","validationCode":"// preflight the API before rendering\nresp, err := http.Get(\"https://statsapi.web.nhl.com/api/v1/teams/LAL\")\nif err != nil || resp.StatusCode != 200 { /* hide segment */ }","typeGuard":null,"tryCatchPattern":"// segment returns (nil, err); treat as 'no data this prompt'\nresult, err := getResult(team)\nif err != nil {\n    // fall back to last-known data or hide the segment\n}","preventionTips":["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"],"tags":["go","http","api","network","segment"],"backgroundTag":"http-request-failed","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}