{"record":{"id":"9d19aeee514b85a6","repo":"kgretzky/evilginx2","slug":"admin-url-is-not-set","errorCode":null,"errorMessage":"admin url is not set","messagePattern":"admin url is not set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/gophish.go","lineNumber":152,"sourceCode":"\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":134,"sourceCodeEnd":159,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/gophish.go#L134-L159","documentation":"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.","triggerScenarios":"Calling Test, ReportEmailOpened, ReportEmailLinkClicked, or ReportCredentialsSubmitted without first calling the setter that populates o.AdminUrl (e.g. SetAdminUrl / config load of gophish admin_url).","commonSituations":"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.","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"],"exampleFix":"// before\nif cfg.gophish_enabled { gp.ReportCredentialsSubmitted(...) } // AdminUrl nil\n// after\ncfg.gophish.SetAdminUrl(\"https://gophish.example.com:3333\")\nif err := cfg.gophish.Test(); err == nil { /* enable reporting */ }","handlingStrategy":"validation","validationCode":"if gp.AdminUrl == nil {\n    return errors.New(\"configure gophish admin url first\")\n}","typeGuard":null,"tryCatchPattern":"if err := gp.ReportCredentialsSubmitted(data); err != nil {\n    if err.Error() == \"admin url is not set\" {\n        // skip reporting or initialize GoPhish settings\n    }\n}","preventionTips":["Always run SetAdminUrl/SetApiKey + Test at startup before enabling reporting","Persist gophish settings in config","Guard reporting calls behind an initialized flag"],"tags":["gophish","config","missing-setting"],"backgroundTag":"missing-config-value","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"}