kgretzky/evilginx2 · error

status: %d

Error message

status: %d

What it means

apiRequest returns this error for any GoPhish admin API response status other than 200 or 401, embedding the numeric status code. It signals an unexpected server-side outcome (e.g. 404 bad URL path, 500 server error).

Source

Thrown at core/gophish.go:146

		SetHeader("Content-Type", "application/json").
		SetAuthToken(o.ApiKey)

	if content != nil {
		resp, err = req.SetBody(content).Post(reqUrl)
	} else {
		resp, err = req.Get(reqUrl)
	}

	if err != nil {
		return err
	}
	switch resp.StatusCode() {
	case 200:
		return nil
	case 401:
		return fmt.Errorf("invalid api key")
	default:
		return fmt.Errorf("status: %d", resp.StatusCode())
	}
}

func (o *GoPhish) validateSetup() error {
	if o.AdminUrl == nil {
		return fmt.Errorf("admin url is not set")
	}
	if o.ApiKey == "" {
		return fmt.Errorf("api key is not set")
	}
	return nil
}

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Log the returned status code and check the GoPhish server logs for the matching error
  2. Verify AdminUrl is the full admin API base (e.g. https://host:3333) and reachable
  3. Upgrade/align the integration with your GoPhish version's API surface
  4. Retry after confirming the GoPhish service is healthy
Defensive patterns

Strategy: retry

Validate before calling

// verify endpoint reachability first
resp, err := http.Head(adminUrl) // expect a response, not connection error

Try / catch

if err := gp.Test(); err != nil {
    var statusErr string
    if _, e := fmt.Sscanf(err.Error(), "status: %d", new(int)); e == nil {
        // inspect GoPhish server logs for the status cause
    }
}

Prevention

When it happens

Trigger: Any GoPhish integration call (Test, ReportEmailOpened, ReportEmailLinkClicked, ReportCredentialsSubmitted) where the server replies with e.g. 404 (wrong AdminUrl path), 403, 429, or 500.

Common situations: AdminUrl missing the /admin/ path prefix or pointing at the phishing server instead of the admin API; GoPhish down or behind a misconfigured reverse proxy; API endpoint changed between GoPhish versions.

Related errors


AI-assisted analysis of kgretzky/evilginx2@4c0988a1d9 (2026-09-05). Data as JSON: /api/errors/c02ee52f080a8ee1. Report an issue: GitHub.