{"record":{"id":"4d50251ae9feceea","repo":"sds/overcommit","slug":"unable-to-read-submodule-information-from-ref","errorCode":null,"errorMessage":"Unable to read submodule information from #{ref}:.gitmodules file: #{e.message}","messagePattern":"Unable to read submodule information from #(.+?):\\.gitmodules file: #(.+?)","errorType":"exception","errorClass":"Overcommit::Exceptions::GitSubmoduleError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/git_repo.rb","lineNumber":273,"sourceCode":"      modules = []\n      IniParse.parse(`git show #{ref}:.gitmodules 2> #{File::NULL}`).each do |section|\n        # git < 1.8.5 does not update the .gitmodules file with submodule\n        # changes, so when we are looking at the current state of the work tree,\n        # we need to check if the submodule actually exists via another method,\n        # since the .gitmodules file we parsed does not represent reality.\n        if ref.nil? && GIT_VERSION < '1.8.5'\n          result = Overcommit::Utils.execute(%W[\n            git submodule status #{section['path']}\n          ])\n          next unless result.success?\n        end\n\n        modules << Submodule.new(section['path'], section['url'])\n      end\n\n      modules\n    rescue IniParse::IniParseError => e\n      raise Overcommit::Exceptions::GitSubmoduleError,\n            \"Unable to read submodule information from #{ref}:.gitmodules file: #{e.message}\"\n    end\n\n    # Returns the names of all branches containing the given commit.\n    #\n    # @param commit_ref [String] git tree ref that resolves to a commit\n    # @return [Array<String>] list of branches containing the given commit\n    def branches_containing_commit(commit_ref)\n      `git branch --column=dense --contains #{commit_ref}`.\n        sub(/\\((HEAD )?detached (from|at) .*?\\)/, ''). # ignore detached HEAD\n        split(/\\s+/).\n        reject { |s| s.empty? || s == '*' }\n    end\n\n    # Returns the name of the currently checked out branch.\n    # @return [String]\n    def current_branch\n      `git symbolic-ref --short -q HEAD`.chomp","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/git_repo.rb#L255-L291","documentation":"Error \"Unable to read submodule information from #{ref}:.gitmodules file: #{e.message}\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/git_repo.rb:273 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the `.gitmodules` file at the referenced commit exists and is valid git-config/ini syntax.","Fix malformed submodule sections in `.gitmodules` (missing headers, unbalanced quotes, duplicate keys) and commit the correction.","If the ref is wrong or missing, pass a valid ref that contains a .gitmodules file."],"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"}