projectdiscovery/nuclei · error

variable value cannot be empty

Error message

variable value cannot be empty

What it means

Error "variable value cannot be empty" thrown in projectdiscovery/nuclei.

Source

Thrown at pkg/protocols/javascript/js.go:188

			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{
					"updatePayload(string, interface{})",
				},
				Description: "update/override any payload from init code. this function is available in init code block only",

View on GitHub (pinned to 265b3a3dec)

When it happens

Trigger: Thrown at pkg/protocols/javascript/js.go:188 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/79b760e1497e3327. Report an issue: GitHub.