{"record":{"id":"5acedca1b68c52b8","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-parse-headers-w","errorCode":null,"errorMessage":"cannot parse headers: %w","messagePattern":"cannot parse headers: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/promauth/config.go","lineNumber":749,"sourceCode":"\t\tactx.mustInitFromBearerToken(opts.BearerToken)\n\t}\n\tif opts.OAuth2 != nil {\n\t\tif actx.getAuthHeader != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot simultaneously use `authorization`, `basic_auth, `bearer_token` and `oauth2`\")\n\t\t}\n\t\tif err := actx.initFromOAuth2Config(baseDir, opts.OAuth2); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot initialize oauth2: %w\", err)\n\t\t}\n\t}\n\tvar tctx tlsContext\n\tif opts.TLSConfig != nil {\n\t\tif err := tctx.initFromTLSConfig(baseDir, opts.TLSConfig); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot initialize tls: %w\", err)\n\t\t}\n\t}\n\theaders, err := parseHeaders(opts.Headers)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot parse headers: %w\", err)\n\t}\n\thd := xxhash.New()\n\tfor _, kv := range headers {\n\t\t_, _ = hd.Write([]byte(kv.key))\n\t\t_, _ = hd.Write([]byte(\"=\"))\n\t\t_, _ = hd.Write([]byte(kv.value))\n\t\t_, _ = hd.Write([]byte(\",\"))\n\t}\n\theadersDigest := fmt.Sprintf(\"digest(headers)=%d\", hd.Sum64())\n\n\tac := &Config{\n\t\ttlsServerName:         tctx.serverName,\n\t\ttlsInsecureSkipVerify: tctx.insecureSkipVerify,\n\t\ttlsMinVersion:         tctx.minVersion,\n\n\t\tgetTLSRootCA:    tctx.getTLSRootCA,\n\t\ttlsRootCADigest: tctx.tlsRootCADigest,\n","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/promauth/config.go#L731-L767","documentation":"Returned by authContext.setHeaders/Config setup in lib/promauth when parseHeaders fails to parse the static HTTP headers map given in opts.Headers. It fires on invalid header syntax in the scrape/auth config (e.g. malformed header name/value); the wrapped error details the offending entry.","triggerScenarios":"Thrown at lib/promauth/config.go:749 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped error to find which header entry is invalid","Format every `headers` entry as `\"Name: value\"` with a colon separator","Remove or fix the offending header entry and reload the config"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}