{"record":{"id":"1d1a5c30b37186fc","repo":"sds/overcommit","slug":"error-listing-files-exit-status-es-result-sta","errorCode":null,"errorMessage":"Error listing files. EXIT STATUS(es): #{result.statuses}.\nSTDOUT(s): #{result.stdouts}.\nSTDERR(s): #{result.stderrs}.","messagePattern":"Error listing files\\. EXIT STATUS\\(es\\): #(.+?)\\.\nSTDOUT\\(s\\): #(.+?)\\.\nSTDERR\\(s\\): #(.+?)\\.","errorType":"exception","errorClass":"Overcommit::Exceptions::Error","httpStatus":null,"severity":"error","filePath":"lib/overcommit/git_repo.rb","lineNumber":115,"sourceCode":"\n      `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.\n        split(\"\\0\").\n        map(&:strip).\n        reject(&:empty?).\n        map { |relative_file| File.expand_path(relative_file) }\n    end\n\n    # Returns the names of files in the given paths that are tracked by git.\n    #\n    # @param paths [Array<String>] list of paths to check\n    # @option options [String] ref ('HEAD') Git ref to check\n    # @return [Array<String>] list of absolute file paths\n    def list_files(paths = [], options = {})\n      ref = options[:ref] || 'HEAD'\n\n      result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)\n      unless result.success?\n        raise Overcommit::Exceptions::Error,\n              \"Error listing files. EXIT STATUS(es): #{result.statuses}.\\n\" \\\n              \"STDOUT(s): #{result.stdouts}.\\n\" \\\n              \"STDERR(s): #{result.stderrs}.\"\n      end\n\n      result.stdout.split(/\\n/).\n        map { |relative_file| File.expand_path(relative_file) }.\n        reject { |file| File.directory?(file) } # Exclude submodule directories\n    end\n\n    # Returns whether the specified file/path is tracked by this repository.\n    #\n    # @param path [String]\n    # @return [true,false]\n    def tracked?(path)\n      Overcommit::Utils.execute(%W[git ls-files #{path} --error-unmatch]).success?\n    end\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/git_repo.rb#L97-L133","documentation":"Error \"Error listing files. EXIT STATUS(es): #{result.statuses}.\nSTDOUT(s): #{result.stdouts}.\nSTDERR(s): #{result.stderrs}.\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/git_repo.rb:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the printed exit statuses and stderr from the `git ls-tree` invocations to find the underlying failure (bad ref, missing object, corrupt repo).","Ensure the referenced git ref exists (default HEAD); on a repo with no commits this call fails until an initial commit is made.","Verify the repository is healthy with `git fsck` and that git works on the PATH."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fee0cd74b26eb81f64b43b7fab17bbb541575cc4","analyzedAt":"2026-08-23T04:07:28.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}