projectdiscovery/nuclei · error
payloads not defined and cannot be updated
Error message
payloads not defined and cannot be updated
What it means
Error "payloads not defined and cannot be updated" thrown in projectdiscovery/nuclei.
Source
Thrown at pkg/protocols/javascript/js.go:218
return gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{
Name: "updatePayload",
Signatures: []string{
"updatePayload(string, interface{})",
},
Description: "update/override any payload from init code. this function is available in init code block only",
FuncDecl: func(varname string, Value any) error {
if request.Payloads == nil {
request.Payloads = make(map[string]interface{})
}
if request.generator != nil {
request.Payloads[varname] = Value
request.generator, err = generators.New(request.Payloads, request.AttackType.Value, request.options.TemplatePath, options.Catalog, options.Options.AttackType, options.Options)
if err != nil {
return err
}
} else {
return fmt.Errorf("payloads not defined and cannot be updated")
}
return nil
},
})
}
opts.Cleanup = func(runtime *goja.Runtime) {
_ = runtime.GlobalObject().Delete("set")
_ = runtime.GlobalObject().Delete("updatePayload")
}
args := compiler.NewExecuteArgs()
allVars := generators.MergeMaps(options.Variables.GetAll(), options.Options.Vars.AsMap(), request.options.Constants)
// proceed with whatever args we have
args.Args, _, _ = request.evaluateArgs(allVars, options, true)
result, err := request.options.JsCompiler.ExecuteWithOptions(context.Background(), initCompiled, args, opts)
if err != nil {
return errkit.Newf("could not execute pre-condition: %s", err)View on GitHub (pinned to 265b3a3dec)
When it happens
Trigger: Thrown at pkg/protocols/javascript/js.go:218 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15).
Data as JSON: /api/errors/1feb3345c8bf776a.
Report an issue: GitHub.