{"record":{"id":"79b760e1497e3327","repo":"projectdiscovery/nuclei","slug":"variable-value-cannot-be-empty","errorCode":null,"errorMessage":"variable value cannot be empty","messagePattern":"variable value cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/protocols/javascript/js.go","lineNumber":188,"sourceCode":"\t\t\tExecutionId:     request.options.Options.ExecutionId,\n\t\t\tTimeoutVariants: request.options.Options.GetTimeouts(),\n\t\t\tSource:          &request.Init,\n\t\t}\n\t\t// register 'export' function to export variables from init code\n\t\t// these are saved in args and are available in pre-condition and request code\n\t\topts.Callback = func(runtime *goja.Runtime) error {\n\t\t\terr := gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{\n\t\t\t\tName: \"set\",\n\t\t\t\tSignatures: []string{\n\t\t\t\t\t\"set(string, interface{})\",\n\t\t\t\t},\n\t\t\t\tDescription: \"set variable from init code. this function is available in init code block only\",\n\t\t\t\tFuncDecl: func(varname string, value any) error {\n\t\t\t\t\tif varname == \"\" {\n\t\t\t\t\t\treturn fmt.Errorf(\"variable name cannot be empty\")\n\t\t\t\t\t}\n\t\t\t\t\tif value == nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"variable value cannot be empty\")\n\t\t\t\t\t}\n\t\t\t\t\tif request.Args == nil {\n\t\t\t\t\t\trequest.Args = make(map[string]interface{})\n\t\t\t\t\t}\n\t\t\t\t\trequest.Args[varname] = value\n\t\t\t\t\treturn nil\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn gojs.RegisterFuncWithSignature(runtime, gojs.FuncOpts{\n\t\t\t\tName: \"updatePayload\",\n\t\t\t\tSignatures: []string{\n\t\t\t\t\t\"updatePayload(string, interface{})\",\n\t\t\t\t},\n\t\t\t\tDescription: \"update/override any payload from init code. this function is available in init code block only\",","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/protocols/javascript/js.go#L170-L206","documentation":"Error \"variable value cannot be empty\" thrown in projectdiscovery/nuclei.","triggerScenarios":"Thrown at pkg/protocols/javascript/js.go:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}