{"record":{"id":"506a5331c867605d","repo":"hashicorp/nomad","slug":"minimum-file-size-is-1mb-got-d","errorCode":null,"errorMessage":"minimum file size is 1MB; got %d","messagePattern":"minimum file size is 1MB; got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":7898,"sourceCode":"// DefaultLogConfig returns the default LogConfig values.\nfunc DefaultLogConfig() *LogConfig {\n\treturn &LogConfig{\n\t\tMaxFiles:      10,\n\t\tMaxFileSizeMB: 10,\n\t\tDisabled:      false,\n\t}\n}\n\n// Validate returns an error if the log config specified are less than the\n// minimum allowed. Note that because we have a non-zero default MaxFiles and\n// MaxFileSizeMB, we can't validate that they're unset if Disabled=true\nfunc (l *LogConfig) Validate(disk *EphemeralDisk) error {\n\tvar mErr multierror.Error\n\tif l.MaxFiles < 1 {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"minimum number of files is 1; got %d\", l.MaxFiles))\n\t}\n\tif l.MaxFileSizeMB < 1 {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"minimum file size is 1MB; got %d\", l.MaxFileSizeMB))\n\t}\n\tif disk != nil {\n\t\tlogUsage := (l.MaxFiles * l.MaxFileSizeMB)\n\t\tif disk.SizeMB <= logUsage {\n\t\t\tmErr.Errors = append(mErr.Errors,\n\t\t\t\tfmt.Errorf(\"log storage (%d MB) must be less than requested disk capacity (%d MB)\",\n\t\t\t\t\tlogUsage, disk.SizeMB))\n\t\t}\n\t}\n\treturn mErr.ErrorOrNil()\n}\n\n// Task is a single process typically that is executed as part of a task group.\ntype Task struct {\n\t// Name of the task\n\tName string\n\n\t// Driver is used to control which driver is used","sourceCodeStart":7880,"sourceCodeEnd":7916,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L7880-L7916","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlogs {\n  max_files     = 10\n  max_file_size = 0\n}\n// after\nlogs {\n  max_files     = 10\n  max_file_size = 10\n}","handlingStrategy":"validation","validationCode":"if t.LogConfig != nil && t.LogConfig.MaxFileSizeMB < 1 {\n  return fmt.Errorf(\"max_file_size must be >= 1 MB, got %d\", t.LogConfig.MaxFileSizeMB)\n}","typeGuard":"func validLogSizeMB(n *int) bool { return n != nil && *n >= 1 }","tryCatchPattern":null,"preventionTips":["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."],"tags":["nomad","validation","job-spec","logging"],"backgroundTag":"invalid-config-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}