sundowndev/phoneinfoga · error

errorResponse.Message

Error message

errorResponse.Message

What it means

numverify.ValidateNumber treats any HTTP status >= 400 as failure: it decodes the JSON body into NumverifyErrorResponse and surfaces the API's 'message' field as a Go error. The text you see is whatever numverify's API returned (e.g. invalid key, missing function, rate limit).

Source

Thrown at lib/remote/suppliers/numverify.go:89

	req, _ := http.NewRequest("GET", url, nil)
	req.Header.Set("Apikey", r.apiKey)

	response, err := client.Do(req)

	if err != nil {
		return nil, err
	}
	defer response.Body.Close()

	// Fill the response with the data from the JSON
	var result NumverifyValidateResponse

	if response.StatusCode >= 400 {
		errorResponse := NumverifyErrorResponse{}
		if err := json.NewDecoder(response.Body).Decode(&errorResponse); err != nil {
			return nil, err
		}
		return nil, errors.New(errorResponse.Message)
	}

	// Use json.Decode for reading streams of JSON data
	if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
		return nil, err
	}

	res = &NumverifyValidateResponse{
		Valid:               result.Valid,
		Number:              result.Number,
		LocalFormat:         result.LocalFormat,
		InternationalFormat: result.InternationalFormat,
		CountryPrefix:       result.CountryPrefix,
		CountryCode:         result.CountryCode,
		CountryName:         result.CountryName,
		Location:            result.Location,
		Carrier:             result.Carrier,
		LineType:            result.LineType,

View on GitHub (pinned to 55807b05b7)

Solutions

  1. Check the message text returned: it usually states 'invalid access key', 'missing access key', etc.
  2. Verify your NUMVERIFY_API_KEY is correct and active in the numverify dashboard
  3. On the free plan, ensure requests are not forced to HTTPS (free tier blocks https)
  4. Check monthly API usage; upgrade plan or wait for quota reset if 250 calls exceeded

Example fix

// before
client.Request().SetApiKey("wrongkey")   // -> error: invalid access key
// after
client.Request().SetApiKey(os.Getenv("NUMVERIFY_API_KEY"))   // valid key
Defensive patterns

Strategy: try-catch

Validate before calling

if resp.StatusCode >= 400 {
    // handle before decoding success payload
}
// pre-call: ensure key present
if os.Getenv("NUMVERIFY_API_KEY") == "" { return errors.New("NUMVERIFY_API_KEY missing") }

Type guard

func isNumverifyAPIError(err error) bool {
    msg := err.Error()
    return strings.Contains(msg, "access key") || strings.Contains(msg, "quota")
}

Try / catch

res, err := supplier.ValidateNumber(n)
if err != nil {
    if isNumverifyAPIError(err) {
        log.Errorf("numverify rejected the request: %v", err)
        return fallbackScanner(n)
    }
    return err
}

Prevention

When it happens

Trigger: The numverify API responds with 400/401/etc — invalid or missing API key, free-plan HTTPS restriction, wrong endpoint, or account quota exhausted — and the error body contains a message field.

Common situations: Using an invalid/expired numverify access key, using HTTPS on the numverify free plan (which only allows HTTP), or exhausting the 250 free monthly API calls.

Related errors


AI-assisted analysis of sundowndev/phoneinfoga@55807b05b7 (2026-09-03). Data as JSON: /api/errors/89000f6bbad8b882. Report an issue: GitHub.