wtfutil/wtf · error

%s

Error message

%s

What it means

apiRequest in the Australian BOM (arpansagovau weather) widget returns fmt.Errorf("%s", resp.Status) when the BOM/ARPANSA HTTP response status is not 200. The error message is the raw HTTP status line (e.g. '404 Not Found' or '503 Service Unavailable'). The upstream call errors are otherwise passed through unchanged.

Source

Thrown at modules/weatherservices/arpansagovau/client.go:71

}

/* -------------------- Unexported Functions -------------------- */

func apiRequest() (*http.Response, error) {
	req, err := http.NewRequest("GET", "https://uvdata.arpansa.gov.au/xml/uvvalues.xml", http.NoBody)
	if err != nil {
		return nil, err
	}

	httpClient := &http.Client{}
	resp, err := httpClient.Do(req)
	if err != nil {
		return nil, err
	}
	defer func() { _ = resp.Body.Close() }()

	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("%s", resp.Status)
	}

	return resp, nil
}
func parseXML(text io.Reader) (Stations, error) {
	dec := xml.NewDecoder(text)
	dec.Strict = false

	var v Stations
	err := dec.Decode(&v)
	return v, err
}

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Check the status line in the message: 404 → verify the station ID/URL against the current BOM API endpoints
  2. Confirm the location/station configuration value matches a valid BOM observation identifier
  3. Test the URL directly with curl or a browser to see whether the endpoint still serves data
  4. For 5xx/503, retry later — ARPANSA/BOM outages are transient

Example fix

// before
station: "IDS60901" // retired ID
// after
station: "IDS60902" // current BOM station ID
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Get(bomURL)
if err != nil { return err }
if resp.StatusCode != 200 {
    return fmt.Errorf("BOM endpoint unhealthy: %s", resp.Status)
}
resp.Body.Close()

Try / catch

data, err := w.getLocationData()
if err != nil {
    log.Printf("BOM fetch failed (%v); retrying with backoff", err)
    select {
    case <-time.After(30 * time.Second):
        data, err = w.getLocationData()
    case <-ctx.Done():
        return ctx.Err()
    }
}

Prevention

When it happens

Trigger: getLocationData → apiRequest performs the HTTP GET; the server responds with any non-200 code — 404 if the station/observation URL path changed, 403 for blocked requests, 5xx or 503 during BOM service disruptions.

Common situations: BOM changes or retires observation endpoints/IDs, station identifier in config is wrong, network middleboxes (proxies, geo-blocks) returning 403, BOM outages.

Related errors


AI-assisted analysis of wtfutil/wtf@bb838c1ccb (2026-09-03). Data as JSON: /api/errors/8d9934cd24514740. Report an issue: GitHub.