wtfutil/wtf · error

server responded with [%d]:%s,url:%s

Error message

server responded with [%d]:%s,url:%s

What it means

Raised in the Pocket client's request helper when the Pocket API responds with HTTP status >= 400: the error includes the status code, the raw response body, and the request URL. Fires for invalid consumer key, expired/invalid access token (401/403), rate limits, or server errors across all Pocket operations (token exchange, fetching and modifying links).

Source

Thrown at modules/pocket/client.go:104

	for key, value := range req.headers {
		request.Header.Add(key, value)
	}
	request.Header.Set("User-Agent", "wtfutil (https://github.com/wtfutil/wtf)")

	resp, err := http.DefaultClient.Do(request)

	if err != nil {
		return err
	}
	defer func() { _ = resp.Body.Close() }()

	responseBody, err := io.ReadAll(resp.Body)

	if err != nil {
		return err
	}
	if resp.StatusCode >= 400 {
		return fmt.Errorf(`server responded with [%d]:%s,url:%s`, resp.StatusCode, responseBody, req.url)
	}

	if err := json.Unmarshal(responseBody, &result); err != nil {
		return fmt.Errorf("could not unmarshal url [%s] \n\t\tresponse [%s] error:%w",
			req.url, responseBody, err)
	}

	return nil

}

type obtainRequestTokenRequest struct {
	ConsumerKey string `json:"consumer_key"`
	RedirectURI string `json:"redirect_uri"`
}

// ObtainRequestToken get request token to be used in the auth workflow
func (client *Client) ObtainRequestToken() (code string, err error) {

View on GitHub (pinned to bb838c1ccb)

Solutions

  1. Re-run the Pocket authorization flow to obtain a fresh access token (delete the stale pocket.data)
  2. Verify the consumer key configured for the widget is valid
  3. Inspect the response body in the error — Pocket returns an X-Error-Code and explanation
  4. Back off if the status indicates rate limiting (429)
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at modules/pocket/client.go:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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