hashicorp/nomad · error
minimum file size is 1MB; got %d
Error message
minimum file size is 1MB; got %d
What it means
Raised by LogConfig.Validate in nomad/structs/structs.go:7898 when MaxFileSizeMB < 1. Each rotated log file must be at least 1 MB, so Nomad rejects log configs with a zero or negative max_file_size. Like the max_files check, this is enforced at job validation time because non-zero defaults cannot be distinguished from explicit unset values.
Source
Thrown at nomad/structs/structs.go:7898
// DefaultLogConfig returns the default LogConfig values.
func DefaultLogConfig() *LogConfig {
return &LogConfig{
MaxFiles: 10,
MaxFileSizeMB: 10,
Disabled: false,
}
}
// Validate returns an error if the log config specified are less than the
// minimum allowed. Note that because we have a non-zero default MaxFiles and
// MaxFileSizeMB, we can't validate that they're unset if Disabled=true
func (l *LogConfig) Validate(disk *EphemeralDisk) error {
var mErr multierror.Error
if l.MaxFiles < 1 {
mErr.Errors = append(mErr.Errors, fmt.Errorf("minimum number of files is 1; got %d", l.MaxFiles))
}
if l.MaxFileSizeMB < 1 {
mErr.Errors = append(mErr.Errors, fmt.Errorf("minimum file size is 1MB; got %d", l.MaxFileSizeMB))
}
if disk != nil {
logUsage := (l.MaxFiles * l.MaxFileSizeMB)
if disk.SizeMB <= logUsage {
mErr.Errors = append(mErr.Errors,
fmt.Errorf("log storage (%d MB) must be less than requested disk capacity (%d MB)",
logUsage, disk.SizeMB))
}
}
return mErr.ErrorOrNil()
}
// Task is a single process typically that is executed as part of a task group.
type Task struct {
// Name of the task
Name string
// Driver is used to control which driver is usedView on GitHub (pinned to 482b49bf1a)
Solutions
- Set max_file_size >= 1 (MB) in the logs block (default is 10).
- Use the default 10 MB if unsure by removing the max_file_size line.
- Disable logging via the proper disabled mechanism rather than shrinking the size to 0.
Example fix
// before
logs {
max_files = 10
max_file_size = 0
}
// after
logs {
max_files = 10
max_file_size = 10
} Defensive patterns
Strategy: validation
Validate before calling
if t.LogConfig != nil && t.LogConfig.MaxFileSizeMB < 1 {
return fmt.Errorf("max_file_size must be >= 1 MB, got %d", t.LogConfig.MaxFileSizeMB)
} Type guard
func validLogSizeMB(n *int) bool { return n != nil && *n >= 1 } Prevention
- Remember max_file_size is in megabytes, not bytes.
- Omit max_file_size to use the 10 MB default.
- Validate jobs with nomad job validate before deployment.
When it happens
Trigger: logs block with max_file_size = 0 or negative; LogConfig{MaxFileSizeMB: 0} passed to Validate; job submissions over the HTTP/RPC API carrying max_file_size < 1.
Common situations: Users set max_file_size = 0 hoping for unlimited or disabled logs; unit confusion (expecting bytes instead of MB) leading to values like 0; generated job specs filling 0 for optional integer fields.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Missing Log Config
- minimum number of files is 1; got %d
- Disconnect cannot be configured with both lost_after and sto
- lost_after cannot be a negative duration
- stop_after cannot be a negative duration
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/506a5331c867605d.
Report an issue: GitHub.