{"record":{"id":"13758e8f69c5de05","repo":"benbjohnson/litestream","slug":"invalid-size-format-w","errorCode":null,"errorMessage":"invalid size format: %w","messagePattern":"invalid size format: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/main.go","lineNumber":1100,"sourceCode":"\t\treturn err\n\t}\n\t*b = ByteSize(size)\n\treturn nil\n}\n\n// ParseByteSize parses a byte size string using github.com/dustin/go-humanize.\n// Supports both SI units (KB=1000, MB=1000², etc.) and IEC units (KiB=1024, MiB=1024², etc.).\n// Examples: \"1MB\", \"5MiB\", \"1.5GB\", \"100B\", \"1024KB\"\nfunc ParseByteSize(s string) (int64, error) {\n\ts = strings.TrimSpace(s)\n\tif s == \"\" {\n\t\treturn 0, fmt.Errorf(\"empty size string\")\n\t}\n\n\t// Use go-humanize to parse the byte size string\n\tbytes, err := humanize.ParseBytes(s)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"invalid size format: %w\", err)\n\t}\n\n\t// Check that the value fits in int64\n\tif bytes > math.MaxInt64 {\n\t\treturn 0, fmt.Errorf(\"size %d exceeds maximum allowed value (%d)\", bytes, int64(math.MaxInt64))\n\t}\n\n\treturn int64(bytes), nil\n}\n\n// ReplicaSettings contains settings shared across replica configurations.\n// These can be set globally in Config or per-replica in ReplicaConfig.\ntype ReplicaSettings struct {\n\tSyncInterval       *time.Duration `yaml:\"sync-interval\"`\n\tValidationInterval *time.Duration `yaml:\"validation-interval\"`\n\n\t// Maximum L0 files to upload in a single monitor sync run.\n\t// Set to zero to process all pending L0 files in one run.","sourceCodeStart":1082,"sourceCodeEnd":1118,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/main.go#L1082-L1118","documentation":"ParseByteSize failed because github.com/dustin/go-humanize could not interpret the string as a byte size. The underlying humanize error is chained, indicating unsupported units or non-numeric characters.","triggerScenarios":"Config size values like \"1 gb\" with unsupported spelling, \"10 bytes\" , \"1,5GB\", \"abc\", or trailing characters such as \"5MB!\" passed to a size config field.","commonSituations":"Typos in unit suffixes (e.g. \"5mB\" vs \"5MB\"), locale-formatted numbers with commas, users writing durations where sizes are expected.","solutions":["Use supported forms: \"1MB\", \"5MiB\", \"1.5GB\", \"100B\", \"1024KB\"","Remove thousands separators and stray characters from the value","Check the chained humanize error text for the offending character"],"exampleFix":"# before\nmax-size: 1,5GB\n# after\nmax-size: 1.5GB","handlingStrategy":"validation","validationCode":"if _, err := humanize.ParseBytes(cfg.Size); err != nil {\n    return fmt.Errorf(\"size %q not parseable: use forms like 1MB, 5MiB, 1.5GB\", cfg.Size)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stick to documented size spellings (MB/MiB/GB/KB/B)","Avoid locale number formatting (no comma separators)","Add a config lint step that runs ParseByteSize on all size fields"],"tags":["config","size","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}