{"record":{"id":"c02ee52f080a8ee1","repo":"kgretzky/evilginx2","slug":"status-d","errorCode":null,"errorMessage":"status: %d","messagePattern":"status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/gophish.go","lineNumber":146,"sourceCode":"\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetAuthToken(o.ApiKey)\n\n\tif content != nil {\n\t\tresp, err = req.SetBody(content).Post(reqUrl)\n\t} else {\n\t\tresp, err = req.Get(reqUrl)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch resp.StatusCode() {\n\tcase 200:\n\t\treturn nil\n\tcase 401:\n\t\treturn fmt.Errorf(\"invalid api key\")\n\tdefault:\n\t\treturn fmt.Errorf(\"status: %d\", resp.StatusCode())\n\t}\n}\n\nfunc (o *GoPhish) validateSetup() error {\n\tif o.AdminUrl == nil {\n\t\treturn fmt.Errorf(\"admin url is not set\")\n\t}\n\tif o.ApiKey == \"\" {\n\t\treturn fmt.Errorf(\"api key is not set\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":128,"sourceCodeEnd":159,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/gophish.go#L128-L159","documentation":"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).","triggerScenarios":"Any GoPhish integration call (Test, ReportEmailOpened, ReportEmailLinkClicked, ReportCredentialsSubmitted) where the server replies with e.g. 404 (wrong AdminUrl path), 403, 429, or 500.","commonSituations":"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.","solutions":["Log the returned status code and check the GoPhish server logs for the matching error","Verify AdminUrl is the full admin API base (e.g. https://host:3333) and reachable","Upgrade/align the integration with your GoPhish version's API surface","Retry after confirming the GoPhish service is healthy"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify endpoint reachability first\nresp, err := http.Head(adminUrl) // expect a response, not connection error","typeGuard":null,"tryCatchPattern":"if err := gp.Test(); err != nil {\n    var statusErr string\n    if _, e := fmt.Sscanf(err.Error(), \"status: %d\", new(int)); e == nil {\n        // inspect GoPhish server logs for the status cause\n    }\n}","preventionTips":["Use the correct admin API base URL and port (default 3333)","Keep GoPhish and integration versions compatible","Monitor GoPhish server logs","Retry transient 5xx with backoff"],"tags":["gophish","http","api"],"backgroundTag":"unexpected-http-status","analyzedSha":"4c0988a1d9db4d172a185e979a38bfd0efdb5830","analyzedAt":"2026-09-05T19:23:07.238Z","contentChangedAt":"2026-09-05T19:23:07.238Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}