{"record":{"id":"f13abd9a2b56b57e","repo":"hashicorp/nomad","slug":"decompression-size-limit-is-not-a-valid-size-w","errorCode":null,"errorMessage":"decompression_size_limit is not a valid size: %w","messagePattern":"decompression_size_limit is not a valid size: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/config/artifact.go","lineNumber":231,"sourceCode":"\t}\n\tif v, err := time.ParseDuration(*a.S3Timeout); err != nil {\n\t\treturn fmt.Errorf(\"s3_timeout not a valid duration: %w\", err)\n\t} else if v < 0 {\n\t\treturn fmt.Errorf(\"s3_timeout must be > 0\")\n\t}\n\n\tif a.DecompressionFileCountLimit == nil {\n\t\treturn fmt.Errorf(\"decompression_file_count_limit must not be nil\")\n\t}\n\tif v := *a.DecompressionFileCountLimit; v < 0 {\n\t\treturn fmt.Errorf(\"decompression_file_count_limit must be >= 0 but found %d\", v)\n\t}\n\n\tif a.DecompressionSizeLimit == nil {\n\t\treturn fmt.Errorf(\"decompression_size_limit must not be nil\")\n\t}\n\tif v, err := humanize.ParseBytes(*a.DecompressionSizeLimit); err != nil {\n\t\treturn fmt.Errorf(\"decompression_size_limit is not a valid size: %w\", err)\n\t} else if v > math.MaxInt64 {\n\t\treturn fmt.Errorf(\"decompression_size_limit must be < %d but found %d\", int64(math.MaxInt64), v)\n\t}\n\n\tif a.DisableArtifactInspection == nil {\n\t\treturn fmt.Errorf(\"disable_artifact_inspection must be set\")\n\t}\n\n\tif a.DisableFilesystemIsolation == nil {\n\t\treturn fmt.Errorf(\"disable_filesystem_isolation must be set\")\n\t}\n\n\tfor _, p := range a.FilesystemIsolationExtraPaths {\n\t\tif _, err := landlock.ParsePath(p); err != nil {\n\t\t\treturn fmt.Errorf(\"filesystem_isolation_extra_paths contains invalid lockdown path %q\", p)\n\t\t}\n\t}\n","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/config/artifact.go#L213-L249","documentation":"Once non-nil, decompression_size_limit must parse as a byte size via humanize.ParseBytes. On parse failure Validate() wraps the error: 'decompression_size_limit is not a valid size: %w'. Valid formats include \"10MB\", \"1GiB\", \"500kb\"; arbitrary strings or numbers with unknown units fail.","triggerScenarios":"Calling ArtifactConfig.Validate() when humanize.ParseBytes(*a.DecompressionSizeLimit) errors, e.g. \"10 mega\", \"1 TB/year\", \"0x1000\", or an empty string \"\".","commonSituations":"Writing plain integers without units (\"1073741824\" alone fails — humanize expects unit suffixes like \"1GB\"); mixing locales (\"1,5 GB\"); typos like \"1GG\"; users copying formats from unrelated tools.","solutions":["Use a recognized unit string, e.g. decompression_size_limit = \"1GB\".","Pre-check locally with humanize.ParseBytes(value) and fix until it returns nil error.","If the source is a raw byte count, format it with humanize.Bytes(count) before assigning."],"exampleFix":"// before\nartifact {\n  decompression_size_limit = \"1073741824\"\n}\n// after\nartifact {\n  decompression_size_limit = \"1GB\"\n}","handlingStrategy":"validation","validationCode":"if _, err := humanize.ParseBytes(cfg.DecompressionSizeLimit); err != nil {\n    return fmt.Errorf(\"decompression_size_limit %q must be like '1GB' or '500MB': %w\", cfg.DecompressionSizeLimit, err)\n}","typeGuard":"func validSizeLimit(s *string) bool {\n    if s == nil { return false }\n    _, err := humanize.ParseBytes(*s)\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["Always include a binary/decimal unit suffix: \"1GB\", \"512MB\", \"10GiB\".","Convert raw byte counts with humanize.Bytes() before writing them to config.","Lint all *_size / *_limit fields with humanize.ParseBytes in CI."],"tags":["nomad","config-validation","size-parse","decompression"],"backgroundTag":"invalid-size-format","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"}