{"record":{"id":"db96e0d789ab665b","repo":"grafana/k6","slug":"the-provided-header-s-does-not-respect-the-expe","errorCode":null,"errorMessage":"the provided header (%s) does not respect the expected format <header key>:<value>","messagePattern":"the provided header \\((.+?)\\) does not respect the expected format <header key>:<value>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/output/prometheusrw/remotewrite/config.go","lineNumber":313,"sourceCode":"\n\terr := envconfig.Process(\"\", &c, func(key string) (string, bool) {\n\t\tv, ok := env[key]\n\t\treturn v, ok\n\t})\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\n\t// We don't rely on `envconfig` for headers, as we do use our own logic/syntax with\n\t// dynamically-defined header-associated environment variables.\n\tenvHeaders := envMap(env, \"K6_PROMETHEUS_RW_HEADERS_\")\n\tmaps.Copy(c.Headers, envHeaders)\n\n\tif headers, headersDefined := env[\"K6_PROMETHEUS_RW_HTTP_HEADERS\"]; headersDefined {\n\t\tfor kvPair := range strings.SplitSeq(headers, \",\") {\n\t\t\theader := strings.Split(kvPair, \":\")\n\t\t\tif len(header) != 2 {\n\t\t\t\treturn c, fmt.Errorf(\"the provided header (%s) does not respect the expected format <header key>:<value>\", kvPair)\n\t\t\t}\n\t\t\tc.Headers[header[0]] = header[1]\n\t\t}\n\t}\n\n\treturn c, nil\n}\n\n// parseJSON parses the supplied JSON into a Config.\nfunc parseJSON(data json.RawMessage) (Config, error) {\n\tvar c Config\n\terr := json.Unmarshal(data, &c)\n\treturn c, err\n}\n\n// parseArg parses the supplied string of arguments into a Config.\nfunc parseArg(text string) (Config, error) {\n\tvar c Config","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/output/prometheusrw/remotewrite/config.go#L295-L331","documentation":"K6_PROMETHEUS_RW_HTTP_HEADERS contained an entry that doesn't split into exactly two colon-separated parts, so it cannot be interpreted as key:value. parseEnvs enforces the <header key>:<value> syntax.","triggerScenarios":"Thrown at internal/output/prometheusrw/remotewrite/config.go:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Format entries as key:value with exactly one colon separator, e.g. K6_PROMETHEUS_RW_HTTP_HEADERS=\"Authorization:Bearer token,X-Custom:yes\"","Remove entries with extra or missing colons"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}