kgretzky/evilginx2 · error
admin url is not set
Error message
admin url is not set
What it means
validateSetup is a generic pre-flight validation guard: the GoPhish integration cannot be used because o.AdminUrl is nil (no admin console URL was configured). It fires before any request is attempted, via Test and the reporting callbacks.
Source
Thrown at core/gophish.go:152
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
- Set the admin URL before use (cfg.SetGoPhishAdminUrl or equivalent setter) e.g. https://gophish-host:3333
- Ensure the gophish admin_url entry persists in config and is loaded at startup
- Call GoPhish Test after setup to validate the configuration
Example fix
// before
if cfg.gophish_enabled { gp.ReportCredentialsSubmitted(...) } // AdminUrl nil
// after
cfg.gophish.SetAdminUrl("https://gophish.example.com:3333")
if err := cfg.gophish.Test(); err == nil { /* enable reporting */ } Defensive patterns
Strategy: validation
Validate before calling
if gp.AdminUrl == nil {
return errors.New("configure gophish admin url first")
} Try / catch
if err := gp.ReportCredentialsSubmitted(data); err != nil {
if err.Error() == "admin url is not set" {
// skip reporting or initialize GoPhish settings
}
} Prevention
- Always run SetAdminUrl/SetApiKey + Test at startup before enabling reporting
- Persist gophish settings in config
- Guard reporting calls behind an initialized flag
When it happens
Trigger: Calling Test, ReportEmailOpened, ReportEmailLinkClicked, or ReportCredentialsSubmitted without first calling the setter that populates o.AdminUrl (e.g. SetAdminUrl / config load of gophish admin_url).
Common situations: Fresh install where gophish admin_url was never set in config; config file loaded but the gophish section omitted; enabling event reporting without completing GoPhish setup.
Understand the failure class
Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.
Related errors
- api key is not set
- phishlet '%s' can't be deleted - you can only delete child p
- index out of bounds: %d
- lure for path '%s' not found
- phishlet '%s' not found
AI-assisted analysis of kgretzky/evilginx2@4c0988a1d9 (2026-09-05).
Data as JSON: /api/errors/9d19aeee514b85a6.
Report an issue: GitHub.