{"record":{"id":"1c0cd7fb9b4f0bf5","repo":"projectdiscovery/nuclei","slug":"variable-name-cannot-be-empty","errorCode":null,"errorMessage":"variable name cannot be empty","messagePattern":"variable name cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/protocols/javascript/js.go","lineNumber":185,"sourceCode":"\t\t}\n\n\t\topts := &compiler.ExecuteOptions{\n\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{","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/protocols/javascript/js.go#L167-L203","documentation":"Error \"variable name cannot be empty\" thrown in projectdiscovery/nuclei.","triggerScenarios":"Thrown at pkg/protocols/javascript/js.go:185 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-16T03:17:38.424Z"}