{"record":{"id":"d1fc37cfe7239d4d","repo":"kgretzky/evilginx2","slug":"script-not-found","errorCode":null,"errorMessage":"script not found","messagePattern":"script not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":855,"sourceCode":"\t\t\t\t\t\tparams_matched = true\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tparams_matched = true\n\t\t\t\t}\n\n\t\t\t\tif params_matched {\n\t\t\t\t\tscript := js.script\n\t\t\t\t\tif params != nil {\n\t\t\t\t\t\tfor k, v := range *params {\n\t\t\t\t\t\t\tscript = strings.Replace(script, \"{\"+k+\"}\", v, -1)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn js.id, script, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", \"\", fmt.Errorf(\"script not found\")\n}\n\nfunc (p *Phishlet) GetScriptInjectById(id string, params *map[string]string) (string, error) {\n\tfor _, js := range p.js_inject {\n\t\tif js.id == id {\n\t\t\tscript := js.script\n\t\t\tif params != nil {\n\t\t\t\tfor k, v := range *params {\n\t\t\t\t\tscript = strings.Replace(script, \"{\"+k+\"}\", v, -1)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn script, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"script not found\")\n}\n","sourceCodeStart":837,"sourceCodeEnd":873,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L837-L873","documentation":"GetScriptInject(id, params) returns this error when no js_inject entry registered on the phishlet matches the given id. The method iterates p.js_inject and falls through to `return \"\", \"\", fmt.Errorf(\"script not found\")` if the loop completes without a match. It signals that the caller requested an injection script by an id that was never loaded from the phishlet config.","triggerScenarios":"Calling p.GetScriptInject(\"some-id\", params) with an id that does not correspond to any `js_inject` entry in the phishlet, e.g. after the phishlet was reloaded and js_inject ids changed, or a stale id cached elsewhere.","commonSituations":"HTTP proxy referencing a script id from an older phishlet version; typo in the id string; phishlet file re-edited so js_inject blocks were renamed or removed while sessions still reference them.","solutions":["Verify the id passed to GetScriptInject matches an existing js_inject entry in the phishlet YAML","Reload/re-list phishlet js_inject entries after any phishlet file edit and refresh cached ids","Handle the error at call sites by skipping the injection instead of treating it as fatal"],"exampleFix":"// before\nscript, jsId, err := ph.GetScriptInject(oldId, params)\n// after\nscript, jsId, err := ph.GetScriptInject(currentJsInjectId, params)\nif err != nil {\n    log.Warning(\"js_inject %s unavailable: %v\", currentJsInjectId, err)\n    return\n}","handlingStrategy":"try-catch","validationCode":"ids := ph.GetScriptInjects() // or re-list js_inject after reload\nif !contains(ids, requestedId) {\n    log.Warning(\"script id %q not present in phishlet\", requestedId)\n    return\n}","typeGuard":"func scriptExists(ph *core.Phishlet, id string) bool {\n    for _, js := range ph.GetScriptInjects() {\n        if js == id { return true }\n    }\n    return false\n}","tryCatchPattern":"script, jsId, err := ph.GetScriptInject(id, params)\nif err != nil {\n    log.Debug(\"script not found for id %s: %v\", id, err)\n    // proceed without injection\n    return \"\", \"\"\n}","preventionTips":["Re-resolve script ids after every phishlet reload","Never hard-code js_inject ids; look them up dynamically","Treat 'script not found' as a soft, non-fatal condition","Log id mismatches to detect phishlet schema drift"],"tags":["phishlet","js-inject","lookup-miss"],"backgroundTag":"resource-not-found","analyzedSha":"4c0988a1d9db4d172a185e979a38bfd0efdb5830","analyzedAt":"2026-09-05T19:23:07.238Z","contentChangedAt":"2026-09-05T19:23:07.238Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}