{"record":{"id":"0f4f17039c2b4417","repo":"remix-run/remix","slug":"files-maxrequesttransforms-must-be-a-positive-inte","errorCode":null,"errorMessage":"files.maxRequestTransforms must be a positive integer","messagePattern":"files\\.maxRequestTransforms must be a positive integer","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/assets/src/lib/files/config.ts","lineNumber":292,"sourceCode":"      throw new TypeError(`files.globalTransforms[${index}].name must be a string`)\n    }\n\n    if (typeof transform.transform !== 'function') {\n      throw new TypeError(`files.globalTransforms[${index}] must define a transform() function`)\n    }\n\n    normalizedGlobalTransforms.push({\n      ...transform,\n      extensions: normalizeTransformExtensions(\n        transform.extensions,\n        `files.globalTransforms[${index}].extensions`,\n      ),\n    })\n  }\n\n  let maxRequestTransforms = files.maxRequestTransforms ?? defaultMaxRequestTransforms\n  if (!Number.isInteger(maxRequestTransforms) || maxRequestTransforms < 1) {\n    throw new TypeError('files.maxRequestTransforms must be a positive integer')\n  }\n\n  if (files.cache !== undefined) {\n    if (\n      files.cache === null ||\n      typeof files.cache !== 'object' ||\n      typeof files.cache.get !== 'function' ||\n      typeof files.cache.set !== 'function'\n    ) {\n      throw new TypeError('files.cache must implement the FileStorage interface')\n    }\n  }\n\n  return {\n    cache: files.cache,\n    extensions: normalizedExtensions,\n    globalTransforms: normalizedGlobalTransforms,\n    hasTransforms: normalizedTransforms.size > 0 || normalizedGlobalTransforms.length > 0,","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/assets/src/lib/files/config.ts#L274-L310","documentation":"The assets package validates the `files.maxRequestTransforms` option before using it. It must be an integer greater than or equal to 1 because it caps how many request transforms can be chained per asset request. Any non-integer (float, string, NaN) or value below 1 throws immediately during option normalization.","triggerScenarios":"Passing `files: { maxRequestTransforms: 0 }`, a negative number, a float like 2.5, or a non-number (e.g. '10' as a string, NaN from bad arithmetic) to resolveAssetServerOptions/normalizeFilesOptions.","commonSituations":"Setting maxRequestTransforms to 0 thinking it disables the limit, computing the value from env vars or config math that yields NaN/fractions, or copying a value from another tool with different semantics.","solutions":["Set a positive integer such as 16 (the default) or higher","If deriving from env/config, wrap with Number() and validate with Number.isInteger before passing","Remove the option entirely to use the default limit"],"exampleFix":"// before\nresolveAssetServerOptions({ files: { maxRequestTransforms: 0 } })\n// after\nresolveAssetServerOptions({ files: { maxRequestTransforms: 16 } })","handlingStrategy":"validation","validationCode":"const v = options.files?.maxRequestTransforms\nif (v !== undefined && (!Number.isInteger(v) || v < 1)) throw new Error('fix maxRequestTransforms')","typeGuard":"function isValidMaxTransforms(v: unknown): v is number {\n  return typeof v === 'number' && Number.isInteger(v) && v >= 1\n}","tryCatchPattern":null,"preventionTips":["Derive the value via a validated number helper when reading from env/config","Default to omitting the option unless you genuinely need a custom cap"],"tags":["config","validation","assets"],"backgroundTag":"invalid-option-value","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}