{"record":{"id":"a9a2ab36b1e05e69","repo":"projectdiscovery/nuclei","slug":"token-cannot-be-empty-in-bearer-token-auth","errorCode":null,"errorMessage":"token cannot be empty in bearer token auth","messagePattern":"token cannot be empty in bearer token auth","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/authprovider/authx/file.go","lineNumber":110,"sourceCode":"\t\tfor _, domain := range s.DomainsRegex {\n\t\t\t_, err := regexp.Compile(domain)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid domain regex: %s\", domain)\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch {\n\tcase strings.EqualFold(s.Type, string(BasicAuth)):\n\t\tif s.Username == \"\" {\n\t\t\treturn fmt.Errorf(\"username cannot be empty in basic auth\")\n\t\t}\n\t\tif s.Password == \"\" {\n\t\t\treturn fmt.Errorf(\"password cannot be empty in basic auth\")\n\t\t}\n\tcase strings.EqualFold(s.Type, string(BearerTokenAuth)):\n\t\tif s.Token == \"\" {\n\t\t\treturn fmt.Errorf(\"token cannot be empty in bearer token auth\")\n\t\t}\n\tcase strings.EqualFold(s.Type, string(HeadersAuth)):\n\t\tif len(s.Headers) == 0 {\n\t\t\treturn fmt.Errorf(\"headers cannot be empty in headers auth\")\n\t\t}\n\t\tfor _, header := range s.Headers {\n\t\t\tif err := header.Validate(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid header in headersAuth: %s\", err)\n\t\t\t}\n\t\t}\n\tcase strings.EqualFold(s.Type, string(CookiesAuth)):\n\t\tif len(s.Cookies) == 0 {\n\t\t\treturn fmt.Errorf(\"cookies cannot be empty in cookies auth\")\n\t\t}\n\t\tfor _, cookie := range s.Cookies {\n\t\t\tif cookie.Raw != \"\" && !s.skipCookieParse {\n\t\t\t\tif err := cookie.Parse(); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"invalid raw cookie in cookiesAuth: %s\", err)","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/authprovider/authx/file.go#L92-L128","documentation":"Error \"token cannot be empty in bearer token auth\" thrown in projectdiscovery/nuclei.","triggerScenarios":"Thrown at pkg/authprovider/authx/file.go:110 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"}