{"record":{"id":"5b033f7d2c30bee8","repo":"apache/beam","slug":"resource-parseminram-unable-to-parse-q-v","errorCode":null,"errorMessage":"resource.ParseMinRAM: unable to parse %q: %v","messagePattern":"resource\\.ParseMinRAM: unable to parse %q: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/options/resource/hint.go","lineNumber":130,"sourceCode":"// Hints are advisory only and runners may not respect them.\n//\n// See https://beam.apache.org/documentation/runtime/resource-hints/ for more information about\n// resource hints.\nfunc MinRAMBytes(v uint64) Hint {\n\treturn minRAMHint{value: int64(v)}\n}\n\n// ParseMinRAM converts various byte units, including MB, GB, MiB, and GiB into a hint.\n// An invalid byte size format will cause ParseMinRAM to panic.\n//\n// Hints are advisory only and runners may not respect them.\n//\n// See https://beam.apache.org/documentation/runtime/resource-hints/ for more information about\n// resource hints.\nfunc ParseMinRAM(v string) Hint {\n\tb, err := humanize.ParseBytes(v)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"resource.ParseMinRAM: unable to parse %q: %v\", v, err))\n\t}\n\treturn MinRAMBytes(b)\n}\n\ntype minRAMHint struct {\n\tvalue int64\n}\n\nfunc (minRAMHint) URN() string {\n\treturn \"beam:resources:min_ram_bytes:v1\"\n}\n\nfunc (h minRAMHint) Payload() []byte {\n\t// Go strings are utf8, and if the string is ascii,\n\t// byte conversion handles that directly.\n\treturn []byte(strconv.FormatInt(h.value, 10))\n}\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/options/resource/hint.go#L112-L148","documentation":"ParseMinRAM converts a human-readable byte-size string (e.g. '4GiB') via humanize.ParseBytes into a MinRAMBytes resource hint. If parsing fails, it panics with 'resource.ParseMinRAM: unable to parse %q: %v', because an unparseable memory hint is treated as a hard configuration error at pipeline construction.","triggerScenarios":"Calling resource.ParseMinRAM with a non-numeric or unknown-unit string such as '8GB?' or 'four gigs', or supplying such a value through jobopts --resource_hints=min_ram=<bad>.","commonSituations":"Typos in the size string, using unit spellings humanize.ParseBytes does not accept (e.g. '8 TB ' with a trailing space), or locale-formatted numbers with commas.","solutions":["Pass a valid size string accepted by dustin/go-humanize, e.g. '8GiB', '4294967296', '8 GB'","Trim whitespace and remove non-numeric characters from the value","Pre-validate with humanize.ParseBytes in a helper before calling ParseMinRAM"],"exampleFix":"// before\nresource.ParseMinRAM(\"8 gigs\")\n// after\nresource.ParseMinRAM(\"8GiB\")","handlingStrategy":"validation","validationCode":"if _, err := humanize.ParseBytes(v); err != nil {\n    return fmt.Errorf(\"invalid min_ram %q: %w\", v, err)\n}","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        err = fmt.Errorf(\"ParseMinRAM rejected value: %v\", r)\n    }\n}()","preventionTips":["Use sizes humanize.ParseBytes understands: '8GiB', '512MB', or raw byte counts","Trim whitespace before passing the value","Unit-test hint parsing with representative values from your config source"],"tags":["go","beam","resource-hints","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}