{"record":{"id":"c7466fb85737f165","repo":"apache/beam","slug":"sourceconfig-valuesize-must-be-1-got-v","errorCode":null,"errorMessage":"SourceConfig.ValueSize must be >= 1. Got: %v","messagePattern":"SourceConfig\\.ValueSize must be >= 1\\. Got: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/synthetic/source.go","lineNumber":266,"sourceCode":"\tb.cfg.HotKeyFraction = val\n\treturn b\n}\n\n// Build constructs the SourceConfig initialized by this builder. It also\n// performs error checking on the fields, and panics if any have been set to\n// invalid values.\nfunc (b *SourceConfigBuilder) Build() SourceConfig {\n\tif b.cfg.InitialSplits <= 0 {\n\t\tpanic(fmt.Sprintf(\"SourceConfig.InitialSplits must be >= 1. Got: %v\", b.cfg.InitialSplits))\n\t}\n\tif b.cfg.NumElements <= 0 {\n\t\tpanic(fmt.Sprintf(\"SourceConfig.NumElements must be >= 1. Got: %v\", b.cfg.NumElements))\n\t}\n\tif b.cfg.KeySize <= 0 {\n\t\tpanic(fmt.Sprintf(\"SourceConfig.KeySize must be >= 1. Got: %v\", b.cfg.KeySize))\n\t}\n\tif b.cfg.ValueSize <= 0 {\n\t\tpanic(fmt.Sprintf(\"SourceConfig.ValueSize must be >= 1. Got: %v\", b.cfg.ValueSize))\n\t}\n\tif b.cfg.NumHotKeys < 0 {\n\t\tpanic(fmt.Sprintf(\"SourceConfig.NumHotKeys must be >= 0. Got: %v\", b.cfg.HotKeyFraction))\n\t}\n\tif b.cfg.HotKeyFraction < 0 || b.cfg.HotKeyFraction > 1 {\n\t\tpanic(fmt.Sprintf(\"SourceConfig.HotKeyFraction must be a floating point number from 0 and 1. Got: %v\", b.cfg.NumHotKeys))\n\t}\n\treturn b.cfg\n}\n\n// BuildFromJSON constructs the SourceConfig by populating it with the parsed\n// JSON. Panics if there is an error in the syntax of the JSON or if the input\n// contains unknown object keys.\n//\n// An example of valid JSON object:\n//\n//\t{\n//\t\t \"num_records\": 5,","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/synthetic/source.go#L248-L284","documentation":"Panic raised by synthetic SourceConfigBuilder.Build when cfg.ValueSize is zero or negative. Like the sibling checks on InitialSplits, NumElements and KeySize, this is an eager configuration validation: value byte length must be a positive number or Build refuses to emit a SourceConfig.","triggerScenarios":"Building a SourceConfig without ValueSize(n) or with ValueSize(0) / a negative value.","commonSituations":"Throughput benchmarks where value size is derived from payload config that can be empty, or omitted builder calls.","solutions":["Call builder.ValueSize(n) with n >= 1 before Build().","Clamp the value-size config value to a minimum of 1.","Validate size fields together in one config-validation pass."],"exampleFix":"// before\ncfg := synthetic.NewSourceConfig().NumElements(100).KeySize(8).ValueSize(0).Build()\n// after\ncfg := synthetic.NewSourceConfig().NumElements(100).KeySize(8).ValueSize(64).Build()","handlingStrategy":"validation","validationCode":"if valueSize < 1 {\n    return fmt.Errorf(\"synthetic ValueSize must be >= 1, got %d\", valueSize)\n}","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        err = fmt.Errorf(\"invalid synthetic source config: %v\", r)\n    }\n}()","preventionTips":["Set ValueSize explicitly in every builder chain.","Validate key and value sizes together in one check.","Guard computed payload sizes against empty/zero inputs."],"tags":["go","apache-beam","synthetic-source","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}