{"record":{"id":"707eec6303f6b48a","repo":"benbjohnson/litestream","slug":"empty-size-string","errorCode":null,"errorMessage":"empty size string","messagePattern":"empty size string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/main.go","lineNumber":1094,"sourceCode":"\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\n\tsize, err := ParseByteSize(s)\n\tif err != nil {\n\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.","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/main.go#L1076-L1112","documentation":"ParseByteSize rejected its input because after trimming whitespace the string was empty. The ByteSize UnmarshalText path handed it a valueless config/flag token such as an empty retention or size field.","triggerScenarios":"A config field expecting a byte size (parsed via ParseByteSize) is set to \"\" or only whitespace, e.g. `retention-check-interval: \"\"` or an env-var expansion that resolved to empty.","commonSituations":"YAML key present with empty value; `${SIZE_ENV}` unset so it expands to an empty string; quoted empty string left over from editing.","solutions":["Set an explicit size value like \"1GB\" or \"5MiB\" on the config key","Remove the empty key to use the built-in default instead","Check that any env var used in the value is actually set at launch"],"exampleFix":"# before\nretention: \"\"\n# after\nretention: 24h  # or use a size key: size: 1GB","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(cfg.Size) == \"\" {\n    return errors.New(\"size must be set, e.g. \\\"1GB\\\"\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave size keys with empty values; delete the key to use defaults","Verify env vars referenced in config values are set at launch","Validate the full config file at startup before deploy"],"tags":["config","validation","size"],"backgroundTag":"empty-required-field","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"}