sundowndev/phoneinfoga · error
result.Message
Error message
result.Message
What it means
OVH supplier's Search treats HTTP >= 400 as failure: it decodes the body into OVHAPIErrorResponse and returns the API's 'message' field as the error. The text is whatever the OVH Telecom REST API returned (auth failure, bad country code path, not found, etc.).
Source
Thrown at lib/remote/suppliers/ovh.go:68
if countryCode == "" {
return nil, fmt.Errorf("country code +%d wasn't recognized", num.CountryCode)
}
// Build the request
response, err := http.Get(fmt.Sprintf("https://api.ovh.com/1.0/telephony/number/detailedZones?country=%s", countryCode))
if err != nil {
return nil, err
}
defer response.Body.Close()
if response.StatusCode >= 400 {
var result OVHAPIErrorResponse
err = json.NewDecoder(response.Body).Decode(&result)
if err != nil {
return nil, err
}
return nil, errors.New(result.Message)
}
// Fill the response with the data from the JSON
var results []OVHAPIResponseNumber
// Use json.Decode for reading streams of JSON data
err = json.NewDecoder(response.Body).Decode(&results)
if err != nil {
return nil, err
}
var foundNumber OVHAPIResponseNumber
rt := reflect.TypeOf(results)
if rt.Kind() == reflect.Slice && len(num.RawLocal) > 6 {
askedNumber := num.RawLocal[0:6] + "xxxx"
for _, result := range results {View on GitHub (pinned to 55807b05b7)
Solutions
- Read the message text: it identifies whether it's 401 auth, 404 route, or 5xx server issue
- Verify OVH API credentials (application key, secret, consumer key) are valid and not expired
- Confirm the phone number's country is supported by the OVH telecom endpoint being used
- Retry later if the message indicates a server-side (5xx) problem
Example fix
// before client.Search(n) // OVH returns 401 'Invalid signature' // after // regenerate OVH consumer key and ensure signature uses current time client = ovh.NewClient(endpoint, appKey, appSecret, consumerKey) client.Search(n)
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure number's country is OVH-supported before calling
if !supportedCountries[n.CountryCode] {
return fmt.Errorf("country %d not queryable via OVH", n.CountryCode)
} Type guard
func isOVHAuthError(err error) bool {
msg := err.Error()
return strings.Contains(msg, "Invalid signature") || strings.Contains(msg, "Unauthorized")
} Try / catch
res, err := supplier.Search(n)
if err != nil {
if isOVHAuthError(err) {
// refresh OVH consumer key / credentials then retry once
return retryWithFreshCredentials(n)
}
return err
} Prevention
- Keep OVH application key/secret/consumer key valid and rotated before expiry
- Only route OVH-supported country codes to this supplier
- Decode error bodies and log the API message for diagnosis
- Retry only on 5xx; fix credentials on 401
When it happens
Trigger: The OVH API responds 4xx/5xx — invalid/expired OVH credentials, malformed search path, unsupported country code producing a bad URL, or server-side failure — and the response body carries a message field.
Common situations: OVH app key/secret/consumer key not configured or expired, querying a country endpoint that does not exist for that number, or OVH API downtime.
Related errors
AI-assisted analysis of sundowndev/phoneinfoga@55807b05b7 (2026-09-03).
Data as JSON: /api/errors/9e0a5d9e7097f3cd.
Report an issue: GitHub.