{"record":{"id":"8f5ea3ab451572a4","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-parse-max-scrape-size-value-q-for-job-n","errorCode":null,"errorMessage":"cannot parse `max_scrape_size` value %q for `job_name` %q`: %w","messagePattern":"cannot parse `max_scrape_size` value %q for `job_name` %q`: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/promscrape/config.go","lineNumber":940,"sourceCode":"\t}\n\tscrapeTimeout := sc.ScrapeTimeout.Duration()\n\tif scrapeTimeout <= 0 {\n\t\tscrapeTimeout = globalCfg.ScrapeTimeout.Duration()\n\t\tif scrapeTimeout <= 0 {\n\t\t\tscrapeTimeout = defaultScrapeTimeout\n\t\t}\n\t}\n\tif scrapeTimeout > scrapeInterval {\n\t\t// Limit the `scrape_timeout` with `scrape_interval` like Prometheus does.\n\t\t// This guarantees that the scraper can miss only a single scrape if the target sometimes responds slowly.\n\t\t// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1281#issuecomment-840538907\n\t\tscrapeTimeout = scrapeInterval\n\t}\n\tmss := maxScrapeSize.N\n\tif sc.MaxScrapeSize != \"\" {\n\t\tn, err := flagutil.ParseBytes(sc.MaxScrapeSize)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot parse `max_scrape_size` value %q for `job_name` %q`: %w\", sc.MaxScrapeSize, jobName, err)\n\t\t}\n\t\tif n > 0 {\n\t\t\tmss = n\n\t\t}\n\t}\n\thonorLabels := sc.HonorLabels\n\thonorTimestamps := sc.HonorTimestamps\n\tdenyRedirects := false\n\tif sc.HTTPClientConfig.FollowRedirects != nil {\n\t\tdenyRedirects = !*sc.HTTPClientConfig.FollowRedirects\n\t}\n\tmetricsPath := sc.MetricsPath\n\tif metricsPath == \"\" {\n\t\tmetricsPath = \"/metrics\"\n\t}\n\tscheme := strings.ToLower(sc.Scheme)\n\tif scheme == \"\" {\n\t\tscheme = \"http\"","sourceCodeStart":922,"sourceCodeEnd":958,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/promscrape/config.go#L922-L958","documentation":"The `max_scrape_size` field must be a valid byte-size string (e.g. 16MB, 1KB) parsed by flagutil.ParseBytes. When parsing fails, the error is wrapped with the raw value and the job's `job_name`, and config loading aborts.","triggerScenarios":"Setting `max_scrape_size` in a scrape_config to a value ParseBytes cannot handle, e.g. \"16 MB\" (space), \"mb\" (no number), \"16Gb\" with unsupported units, or a non-numeric string.","commonSituations":"Typos like '16MBs' or '16 mib' with spaces; copying Prometheus' body_size_limit syntax variants; leaving placeholder text from templates.","solutions":["Fix the value to a supported format like `16MB`, `1KB`, or `4MiB` without spaces","Use plain integers (bytes) if unsure of suffix support","Run the config through -dryRun to catch all parsing errors at once"],"exampleFix":"// before\nscrape_configs:\n  - job_name: app\n    max_scrape_size: 16 MB\n// after\nscrape_configs:\n  - job_name: app\n    max_scrape_size: 16MB\n","handlingStrategy":"validation","validationCode":"// Check max_scrape_size parses before load\nif sc.MaxScrapeSize != \"\" {\n\tif _, err := flagutil.ParseBytes(sc.MaxScrapeSize); err != nil {\n\t\treturn fmt.Errorf(\"job %q: bad max_scrape_size %q\", sc.JobName, sc.MaxScrapeSize)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := promscrape.CheckConfig(); err != nil {\n\tlogger.Fatalf(\"error when checking -promscrape.config: %s\", err)\n}","preventionTips":["Use flagutil-compatible size strings like 16MB/1KB with no spaces","Keep a lint rule rejecting values not matching ^\\d+(KB|MB|GB|KiB|MiB|GiB|B)?$","Prefer omitting the field to inherit defaults rather than guessing formats"],"tags":["config","promscrape","parsing","bytes"],"backgroundTag":"invalid-byte-size-value","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"}