{"record":{"id":"d899a3621b474e53","repo":"remix-run/remix","slug":"files-globaltransforms-index-name-must-be-a-st","errorCode":null,"errorMessage":"files.globalTransforms[${index}].name must be a string","messagePattern":"files\\.globalTransforms\\[(.+?)\\]\\.name must be a string","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/assets/src/lib/files/config.ts","lineNumber":274,"sourceCode":"  let globalTransforms = files.globalTransforms ?? []\n  if (!Array.isArray(globalTransforms)) {\n    throw new TypeError('files.globalTransforms must be an array')\n  }\n\n  let normalizedGlobalTransforms: ResolvedAssetGlobalTransform[] = []\n\n  for (let [index, transform] of globalTransforms.entries()) {\n    if (typeof transform === 'function') {\n      normalizedGlobalTransforms.push({ transform })\n      continue\n    }\n\n    if (transform === null || typeof transform !== 'object') {\n      throw new TypeError(`files.globalTransforms[${index}] must be a function or object`)\n    }\n\n    if ('name' in transform && transform.name !== undefined && typeof transform.name !== 'string') {\n      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')","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/assets/src/lib/files/config.ts#L256-L292","documentation":"When a `files.globalTransforms` entry is an object, its optional `name` field (used for logging/identification) must be a string if present. This error fires when `name` is set to a non-string value such as a number, boolean, or object.","triggerScenarios":"`globalTransforms: [{ name: 1, transform: fn }]` or any object entry whose `name` property is defined but not a string.","commonSituations":"Names derived from counters or enums (numbers); booleans from config toggles accidentally assigned to `name`; spread objects carrying an unexpected `name` key.","solutions":["Make `name` a string (`{ name: 'minify', transform: fn }`) or remove the field entirely","Coerce dynamic names: `{ name: String(id), transform: fn }`"],"exampleFix":"// before\nfiles: { globalTransforms: [{ name: 1, transform: fn }] }\n// after\nfiles: { globalTransforms: [{ name: 'minify', transform: fn }] }","handlingStrategy":"validation","validationCode":"if ('name' in t && t.name !== undefined && typeof t.name !== 'string') {\n  t.name = String(t.name)\n}","typeGuard":"function hasValidName(t: { name?: unknown }): boolean {\n  return t.name === undefined || typeof t.name === 'string'\n}","tryCatchPattern":null,"preventionTips":["Use descriptive string names for global transforms or omit name","Coerce numeric identifiers with String() before config"],"tags":["config","files","transforms","naming","validation"],"backgroundTag":"config-type-validation","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}