{"record":{"id":"9e0a5d9e7097f3cd","repo":"sundowndev/phoneinfoga","slug":"result-message","errorCode":null,"errorMessage":"result.Message","messagePattern":"result\\.Message","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"lib/remote/suppliers/ovh.go","lineNumber":68,"sourceCode":"\n\tif countryCode == \"\" {\n\t\treturn nil, fmt.Errorf(\"country code +%d wasn't recognized\", num.CountryCode)\n\t}\n\n\t// Build the request\n\tresponse, err := http.Get(fmt.Sprintf(\"https://api.ovh.com/1.0/telephony/number/detailedZones?country=%s\", countryCode))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer response.Body.Close()\n\n\tif response.StatusCode >= 400 {\n\t\tvar result OVHAPIErrorResponse\n\t\terr = json.NewDecoder(response.Body).Decode(&result)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, errors.New(result.Message)\n\t}\n\n\t// Fill the response with the data from the JSON\n\tvar results []OVHAPIResponseNumber\n\n\t// Use json.Decode for reading streams of JSON data\n\terr = json.NewDecoder(response.Body).Decode(&results)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar foundNumber OVHAPIResponseNumber\n\n\trt := reflect.TypeOf(results)\n\tif rt.Kind() == reflect.Slice && len(num.RawLocal) > 6 {\n\t\taskedNumber := num.RawLocal[0:6] + \"xxxx\"\n\n\t\tfor _, result := range results {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/sundowndev/phoneinfoga/blob/55807b05b753dab7bc6fe67403ca385668dda179/lib/remote/suppliers/ovh.go#L50-L86","documentation":"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.).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nclient.Search(n)   // OVH returns 401 'Invalid signature'\n// after\n// regenerate OVH consumer key and ensure signature uses current time\nclient = ovh.NewClient(endpoint, appKey, appSecret, consumerKey)\nclient.Search(n)","handlingStrategy":"try-catch","validationCode":"// ensure number's country is OVH-supported before calling\nif !supportedCountries[n.CountryCode] {\n    return fmt.Errorf(\"country %d not queryable via OVH\", n.CountryCode)\n}","typeGuard":"func isOVHAuthError(err error) bool {\n    msg := err.Error()\n    return strings.Contains(msg, \"Invalid signature\") || strings.Contains(msg, \"Unauthorized\")\n}","tryCatchPattern":"res, err := supplier.Search(n)\nif err != nil {\n    if isOVHAuthError(err) {\n        // refresh OVH consumer key / credentials then retry once\n        return retryWithFreshCredentials(n)\n    }\n    return err\n}","preventionTips":["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"],"tags":["ovh","http-error","api-response","third-party"],"backgroundTag":"upstream-api-error-response","analyzedSha":"55807b05b753dab7bc6fe67403ca385668dda179","analyzedAt":"2026-09-03T13:37:27.908Z","contentChangedAt":"2026-09-03T13:37:27.908Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}