{"record":{"id":"c0981369b05ca366","repo":"balderdashy/sails","slug":"ignoring-unexpected-files-property-in-helper-def","errorCode":null,"errorMessage":"Ignoring unexpected `files` property in helper definition loaded from ${helperDef._loadedFrom}.  This feature can only be used by actions, not by helpers!","messagePattern":"Ignoring unexpected `files` property in helper definition loaded from (.+?)\\.  This feature can only be used by actions, not by helpers!","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/hooks/helpers/private/load-helpers.js","lineNumber":64,"sourceCode":"          var keyPath = _.map(identity.split('/'), _.camelCase).join('.');\n\n          // Save _loadedFrom property for debugging purposes.\n          // (e.g. `financial/calculate-mortgage-series`)\n          helperDef._loadedFrom = identity;\n\n          // Save _fromLocalSailsApp for internal use.\n          helperDef._fromLocalSailsApp = true;\n\n          // Use filename-derived `identity` REGARDLESS if an explicit identity\n          // was set.  (And exclude any extra hierarchy.)  Otherwise, as of\n          // machine@v15, this could fail with an ImplementationError.\n          helperDef.identity = identity.match(/\\//) ? _.last(identity.split('/')) : identity;\n\n          // Check helper def to make sure it doesn't include any obvious signs\n          // of confusion with actions -- e.g. no \"responseType\".  If anything\n          // like that is detected, log a warning.\n          if (helperDef.files) {\n            sails.log.warn(\n              'Ignoring unexpected `files` property in helper definition loaded '+\n              'from '+helperDef._loadedFrom+'.  This feature can only be used '+\n              'by actions, not by helpers!'\n            );\n          }\n          var hasAnyConfusingExitProps = (\n            _.isObject(helperDef.exits) &&\n            _.any(helperDef.exits, function(exitDef){\n              return (\n                _.isObject(exitDef) &&\n                (\n                  exitDef.responseType !== undefined ||\n                  exitDef.viewTemplatePath !== undefined ||\n                  exitDef.statusCode !== undefined\n                )\n              );\n            })\n          );","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/lib/hooks/helpers/private/load-helpers.js#L46-L82","documentation":"Helpers in Sails cannot use the `files` property (multipart file upload support), which is exclusive to actions. When the helpers hook loads a helper definition that includes `files`, it logs this warning and ignores that property, telling you the file the helper was loaded from and that `files` is actions-only.","triggerScenarios":"A helper in api/helpers defines `files: [...]` (or similar) in its fnInputs/def, detected while load-helpers.js inspects each loaded helper definition.","commonSituations":"Copy-pasting an action into a helper (including its `files` option), refactoring an upload action into a helper expecting uploads to still work, or scaffolding tools that carried the property over.","solutions":["Remove the `files` property from the helper definition.","Perform file uploads in an action (actions2 with `files`), then pass file metadata/contents into the helper as normal inputs.","Rename/restructure the helper back into an action if upload handling is its core purpose."],"exampleFix":"// before (api/helpers/upload-avatar.js)\nmodule.exports = { files: ['avatar'], fn: async (inputs) => {...} };\n// after\nmodule.exports = { fn: async ({ avatar }) => {...} }; // handle req.file(...) in the action, pass the upload here","handlingStrategy":"validation","validationCode":"if (helperDef.files !== undefined) console.warn('`files` is only valid in actions; remove it from helper ' + identity);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never copy the `files` option from an action into a helper.","Handle req.file(...) uploads in actions and pass results into helpers as inputs.","Keep helpers side-effect-free with respect to HTTP request/response."],"tags":["helpers","actions2","file-upload","api-misuse"],"backgroundTag":"invalid-helper-property","analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}