{"record":{"id":"594dc22b6b76d84e","repo":"sds/overcommit","slug":"link-name-is-not-a-symlink","errorCode":null,"errorMessage":"#{link_name} is not a symlink","messagePattern":"#(.+?) is not a symlink","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/utils/file_utils.rb","lineNumber":40,"sourceCode":"      # `File.symlink`.\n      def symlink?(file_name)\n        return File.symlink?(file_name) unless Overcommit::OS.windows?\n\n        result = win32_dir_cmd(file_name)\n        win32_symlink?(result.stdout)\n      end\n\n      # When the host OS is Windows, uses the `dir` command to check whether\n      # `link_name` is an NTFS symbolic link. If so, it parses the target from\n      # the command output. Otherwise raises an `ArgumentError`. Delegates to\n      # `File.readlink` if the host OS is not Windows.\n      def readlink(link_name)\n        return File.readlink(link_name) unless Overcommit::OS.windows?\n\n        result = win32_dir_cmd(link_name)\n\n        unless win32_symlink?(result.stdout)\n          raise ArgumentError, \"#{link_name} is not a symlink\"\n        end\n\n        # Extract symlink target from output, which looks like:\n        #   11/13/2012 12:53 AM <SYMLINK> mysymlink [C:\\Windows\\Temp\\somefile.txt]\n        result.stdout[/\\[(.+)\\]/, 1]\n      end\n\n      private\n\n      def win32_dir_cmd(file_name)\n        Overcommit::Subprocess.spawn(\n          %W[dir #{win32_fix_pathsep(file_name)}]\n        )\n      end\n\n      def win32_mklink_cmd(old_name, new_name)\n        Overcommit::Subprocess.spawn(\n          %W[mklink #{win32_fix_pathsep(new_name)} #{win32_fix_pathsep(old_name)}]","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/utils/file_utils.rb#L22-L58","documentation":"Error \"#{link_name} is not a symlink\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/utils/file_utils.rb:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the path expected to be an Overcommit hook link is actually a symlink before operating on it.","If a regular file exists where the hook symlink should be, move or remove it and rerun `overcommit --install`.","Use `overcommit --uninstall` to remove hooks cleanly instead of replacing symlinks with real files."],"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"}