projectdiscovery/nuclei · error
variable name cannot be empty
Error message
variable name cannot be empty
What it means
Error "variable name cannot be empty" thrown in projectdiscovery/nuclei.
Source
Thrown at pkg/protocols/javascript/js.go:185
}
opts := &compiler.ExecuteOptions{
ExecutionId: request.options.Options.ExecutionId,
TimeoutVariants: request.options.Options.GetTimeouts(),
Source: &request.Init,
}
// register 'export' function to export variables from init code
// these are saved in args and are available in pre-condition and request code
opts.Callback = func(runtime *goja.Runtime) error {
err := gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{
Name: "set",
Signatures: []string{
"set(string, interface{})",
},
Description: "set variable from init code. this function is available in init code block only",
FuncDecl: func(varname string, value any) error {
if varname == "" {
return fmt.Errorf("variable name cannot be empty")
}
if value == nil {
return fmt.Errorf("variable value cannot be empty")
}
if request.Args == nil {
request.Args = make(map[string]interface{})
}
request.Args[varname] = value
return nil
},
})
if err != nil {
return err
}
return gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{
Name: "updatePayload",
Signatures: []string{View on GitHub (pinned to 265b3a3dec)
When it happens
Trigger: Thrown at pkg/protocols/javascript/js.go:185 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/1c0cd7fb9b4f0bf5.
Report an issue: GitHub.