{"record":{"id":"dd932055c2fcb531","repo":"puppetlabs/puppet","slug":"could-not-find-path-on-disk","errorCode":null,"errorMessage":"Could not find %{path} on disk","messagePattern":"Could not find %(.+?) on disk","errorType":"exception","errorClass":"InvalidFile","httpStatus":null,"severity":"error","filePath":"lib/puppet/module/task.rb","lineNumber":133,"sourceCode":"                  { module_name: module_name, filename: endpath })\n          raise InvalidMetadata.new(msg, 'puppet.tasks/invalid-metadata')\n        end\n\n        unless MOUNTS.include? mount\n          msg = _(\"Files must be saved in module directories that Puppet makes available via mount points: %{mounts}\" %\n                  { mounts: MOUNTS.join(', ') })\n          raise InvalidMetadata.new(msg, 'puppet.tasks/invalid-metadata')\n        end\n\n        path = File.join(pup_module.path, mount, endpath)\n        unless File.absolute_path(path) == File.path(path).chomp('/')\n          msg = _(\"File pathnames cannot include relative paths\")\n          raise InvalidMetadata.new(msg, 'puppet.tasks/invalid-metadata')\n        end\n\n        unless File.exist?(path)\n          msg = _(\"Could not find %{path} on disk\" % { path: path })\n          raise InvalidFile, msg\n        end\n\n        last_char = file[-1] == '/'\n        if File.directory?(path)\n          unless last_char\n            msg = _(\"Directories specified in task metadata must include a trailing slash: %{dir}\" % { dir: file })\n            raise InvalidMetadata.new(msg, 'puppet.tasks/invalid-metadata')\n          end\n          dir_files = Dir.glob(\"#{path}**/*\").select { |f| File.file?(f) }\n          dir_files.map { |f| get_file_details(f, pup_module) }\n        else\n          if last_char\n            msg = _(\"Files specified in task metadata cannot include a trailing slash: %{file}\" % { file: file })\n            raise InvalidMetadata.new(msg, 'puppet.task/invalid-metadata')\n          end\n          get_file_details(path, pup_module)\n        end\n      end","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/module/task.rb#L115-L151","documentation":"Raised by Puppet::Module::Task#get_file_details when a file path listed in a task's metadata.json 'files' array resolves (relative to the module root plus its mount point) to a path that does not exist on disk. The task metadata declares supporting files that get bundled with the task; if the declaration points at a missing file, the task cannot be packaged or executed. This is a Puppet::Module::Task::InvalidFile error.","triggerScenarios":"metadata.json for a task contains a 'files' entry like \"files/foo.sh\" but that file was never created, was renamed, or was not committed to the module repo; running `puppet app show` / `bolt task show` / task packaging invokes Task.get_file_details which does File.exist?(File.join(module.path, mount, endpath)) and raises when it returns false.","commonSituations":"Task file listed in metadata but .gitignore'd (e.g. compiled binaries); case-sensitivity mismatch between metadata ('Files/plans.rb') and filesystem after developing on macOS/Windows and deploying to Linux; moving a helper script without updating metadata.json; packaging a module on a machine where the file was deleted.","solutions":["Verify each entry in the task metadata.json 'files' array exists under the module root, creating the missing file.","Fix path typos, wrong mount point ('files/' vs 'tasks/'), or case mismatches in the metadata strings.","Remove stale 'files' entries for files that no longer ship with the task.","Re-run `puppet module build` or the task listing command to confirm resolution succeeds."],"exampleFix":"// tasks/mytask.json - before\n{ \"implementations\": [{ \"name\": \"mytask.py\" }], \"files\": [\"files/helper.sh\"] }\n\n// after (helper removed or restored)\n{ \"implementations\": [{ \"name\": \"mytask.py\" }], \"files\": [] }","handlingStrategy":"validation","validationCode":"meta = Puppet::Util::Json.load(File.read(task_metadata_path))\nfiles = meta.fetch('files', [])\nmissing = files.reject { |f| File.exist?(File.join(module_root, f.chomp('/'))) }\nabort \"metadata references missing files: #{missing}\" unless missing.empty?","typeGuard":null,"tryCatchPattern":"begin\n  Puppet::Module::Task.instances(mod)\nrescue Puppet::Module::Task::InvalidFile => e\n  warn \"task file missing: #{e.message}\" # skip this task, continue\nend","preventionTips":["Add a CI check that every 'files' entry in each tasks/*.json resolves under the module root.","Commit task support files alongside metadata; never list files that are gitignored.","Use case-consistent paths (all lowercase) to avoid cross-filesystem case mismatches."],"tags":["puppet","tasks","bolt","metadata-json","file-not-found"],"backgroundTag":"missing-task-file","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}