sds/overcommit · error · ArgumentError
#{link_name} is not a symlink
Error message
#{link_name} is not a symlink What it means
Error "#{link_name} is not a symlink" thrown in sds/overcommit.
Source
Thrown at lib/overcommit/utils/file_utils.rb:40
# `File.symlink`.
def symlink?(file_name)
return File.symlink?(file_name) unless Overcommit::OS.windows?
result = win32_dir_cmd(file_name)
win32_symlink?(result.stdout)
end
# When the host OS is Windows, uses the `dir` command to check whether
# `link_name` is an NTFS symbolic link. If so, it parses the target from
# the command output. Otherwise raises an `ArgumentError`. Delegates to
# `File.readlink` if the host OS is not Windows.
def readlink(link_name)
return File.readlink(link_name) unless Overcommit::OS.windows?
result = win32_dir_cmd(link_name)
unless win32_symlink?(result.stdout)
raise ArgumentError, "#{link_name} is not a symlink"
end
# Extract symlink target from output, which looks like:
# 11/13/2012 12:53 AM <SYMLINK> mysymlink [C:\Windows\Temp\somefile.txt]
result.stdout[/\[(.+)\]/, 1]
end
private
def win32_dir_cmd(file_name)
Overcommit::Subprocess.spawn(
%W[dir #{win32_fix_pathsep(file_name)}]
)
end
def win32_mklink_cmd(old_name, new_name)
Overcommit::Subprocess.spawn(
%W[mklink #{win32_fix_pathsep(new_name)} #{win32_fix_pathsep(old_name)}]View on GitHub (pinned to fee0cd74b2)
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.
When it happens
Trigger: Thrown at lib/overcommit/utils/file_utils.rb:40 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sds/overcommit@fee0cd74b2 (2026-08-23).
Data as JSON: /api/errors/594dc22b6b76d84e.
Report an issue: GitHub.