{"record":{"id":"364c9e578e1ed67a","repo":"hashicorp/nomad","slug":"failed-to-parse-max-job-source-bytes-w","errorCode":null,"errorMessage":"failed to parse max job source bytes: %w","messagePattern":"failed to parse max job source bytes: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/agent.go","lineNumber":706,"sourceCode":"\t\t\t\t\t\tlsc.Verification.Interval, err)\n\t\t\t\t}\n\t\t\t\tconf.RaftLogStoreConfig.VerificationInterval = dur\n\t\t\t}\n\t\t}\n\t} else if bolt := agentConfig.Server.RaftBoltConfig; bolt != nil {\n\t\t// Backwards compatibility: migrate deprecated raft_boltdb settings\n\t\tconf.RaftLogStoreConfig.BoltDBNoFreelistSync = bolt.NoFreelistSync\n\t\t// Clear the legacy field after migration\n\t\tagentConfig.Server.RaftBoltConfig = nil\n\t}\n\n\t// Interpret job_max_source_size as bytes from string value\n\tif agentConfig.Server.JobMaxSourceSize == nil {\n\t\tagentConfig.Server.JobMaxSourceSize = new(\"1M\")\n\t}\n\tjobMaxSourceBytes, err := humanize.ParseBytes(*agentConfig.Server.JobMaxSourceSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse max job source bytes: %w\", err)\n\t}\n\tconf.JobMaxSourceSize = int(jobMaxSourceBytes)\n\n\tconf.Reporting = agentConfig.Reporting\n\t// Pass the server's production status through to the reporting config\n\tconf.Reporting.NonProduction = agentConfig.Server.NonProduction\n\n\tconf.KEKProviderConfigs = agentConfig.KEKProviders\n\n\tif startTimeout := agentConfig.Server.StartTimeout; startTimeout != \"\" {\n\t\tdur, err := time.ParseDuration(startTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse start_timeout: %v\", err)\n\t\t} else if dur <= time.Duration(0) {\n\t\t\treturn nil, fmt.Errorf(\"start_timeout should be greater than 0s\")\n\t\t}\n\t\tconf.StartTimeout = dur\n\t}","sourceCodeStart":688,"sourceCodeEnd":724,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/agent.go#L688-L724","documentation":"convertServerConfig parses server.job_max_source_size (a string like \"1M\") with hashicorp/go-humanize's ParseBytes to convert it to a byte count for the job source size limit. If the string is not a valid humanized byte size, the parse error is wrapped as \"failed to parse max job source bytes\" and config conversion fails.","triggerScenarios":"Setting job_max_source_size to something humanize.ParseBytes cannot parse — e.g. \"1GBi\", \"10 mb\" with unexpected casing/spaces is tolerated but \"1x\", \"abc\", \"\" (empty string pointer), or a bare number with a bad suffix fails. Also triggered when templating injects a units-suffixed value like \"1048576 bytes\".","commonSituations":"Confusing SI vs binary suffixes or inventing suffixes (\"1MBps\"); environment-variable substitution leaving the value empty; setting it to a raw integer assuming it is bytes (that actually works with ParseBytes, but \"1048576B\" style mistakes are common); copy-paste from docs using a different size syntax.","solutions":["Set job_max_source_size to a valid humanized size, e.g. job_max_source_size = \"10M\" (units B, KB, MB, GB, TB supported).","If a variable supplies the value, ensure it renders as a clean humanized string with no extra text.","Omit the key entirely to use the default (1M).","Run `nomad validate` on the config to catch the parse failure before restart."],"exampleFix":"// before\nserver {\n  job_max_source_size = \"1x\"\n}\n// after\nserver {\n  job_max_source_size = \"10M\"\n}","handlingStrategy":"validation","validationCode":"if _, err := humanize.ParseBytes(sizeStr); err != nil {\n    return fmt.Errorf(\"job_max_source_size %q is not a valid size (use e.g. 1M, 512KB, 2G): %v\", sizeStr, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use humanize-accepted suffixes: B, KB, MB, GB, TB.","Do not append prose to the value (\"1048576 bytes\" fails); use \"1M\".","Check that templating does not render the field empty; run `nomad validate` in CI."],"tags":["nomad","config-validation","byte-parsing","humanize"],"backgroundTag":"invalid-size-format","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}