JanDeDobbeleer/oh-my-posh · error
Withings API error: <status>
Error message
Withings API error: <status>
What it means
The withings segment calls the Withings API through getWithingsData; the response body carries a Status field where 0 means success. When a response returns a non-zero Status code the segment converts it to this error string 'Withings API error: <status>'. The underlying request itself succeeded at the HTTP level; the API rejected or partially failed the logical call.
Source
Thrown at src/segments/withings.go:131
formData := url.Values{
withingsActionKey: {"get"},
"startdate": {strconv.FormatInt(start, 10)},
"enddate": {strconv.FormatInt(end, 10)},
}
return w.getWithingsData("https://wbsapi.withings.net/v2/sleep", formData)
}
func (w *withingsAPI) getWithingsData(endpoint string, formData url.Values) (*WithingsData, error) {
modifiers := func(request *httplib.Request) {
request.Method = httplib.MethodPost
request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
}
body := strings.NewReader(formData.Encode())
data, err := w.Result[*WithingsData](endpoint, body, modifiers)
if data != nil && data.Status != 0 {
return nil, errors.New("Withings API error: " + strconv.Itoa(data.Status))
}
return data, err
}
type Withings struct {
Base
api WithingsAPI
SleepHours string
Weight float64
Steps int
}
const (
WithingsAccessTokenKey = "withings_access_token"
WithingsRefreshTokenKey = "withings_refresh_token"
)View on GitHub (pinned to 0976794618)
Solutions
- Re-authenticate the Withings integration to refresh the OAuth token
- Check the numeric status against Withings API docs and fix the corresponding request parameter
- Retry later if the status is a 5xx service error
- Review segment config options (measure type, date ranges) that alter the endpoint call
Defensive patterns
Strategy: try-catch
Try / catch
// check status proactively and handle non-zero codes
data, err := w.Result[*WithingsData](endpoint, body, modifiers)
if data != nil && data.Status != 0 {
switch data.Status {
case 284, 293:
// re-authenticate / refresh token
default:
// log and fall back to hiding the segment
}
return nil, err
} Prevention
- Refresh OAuth tokens before expiry
- Validate Withings API parameters against the official status code list
- Add retry with backoff for 5xx statuses
- Hide the segment gracefully on API errors
When it happens
Trigger: GetMeasures, GetActivities or GetSleep call getWithingsData, the HTTP result is non-nil with Status != 0 — e.g. status 2 (invalid params), 284/293 (auth/token issues), 500-series Withings service errors — and the segment surfaces the numeric status.
Common situations: Expired or insufficient-scope OAuth token; querying measures for a date range with no data; Withings service outage; malformed endpoint parameters built by the segment config.
Related errors
- unable to get data for team %s
- the wasm build renders from data only and cannot make reques
- no elements in the array
- received empty token
- failed to download zip file: %s → %s
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/c3871cacec5c8dfc.
Report an issue: GitHub.