The output of thefuck --version (something like The Fuck 3.1 using Python 3.5.0):
The Fuck 3.26 using Python 3.6.5
Your shell and its version (bash, zsh, Windows PowerShell, etc.):
Fish v2.7.1 (works fine in Bash)
Your system (Debian 7, ArchLinux, Windows, etc.):
macOS 10.13.5 Beta (17F45c)
How to reproduce the bug:
Run 'fuck' command after entering any incorrect command in Fish shell.
The output of The Fuck with THEFUCK_DEBUG=true exported (typically execute export THEFUCK_DEBUG=true in your shell before The Fuck):
DEBUG: Run with settings: {'alter_history': True,
'debug': True,
'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'},
'exclude_rules': [],
'history_limit': None,
'instant_mode': False,
'no_colors': False,
'priority': {},
'repeat': False,
'require_confirmation': True,
'rules': [<const: All rules enabled>],
'slow_commands': ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'],
'user_dir': PosixPath('/Users/user/.config/thefuck'),
'wait_command': 3,
'wait_slow_command': 15}
DEBUG: Total took: 0:00:00.296931
Traceback (most recent call last):
File "/usr/local/bin/thefuck", line 12, in <module>
sys.exit(main())
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/entrypoints/main.py", line 25, in main
fix_command(known_args)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/entrypoints/fix_command.py", line 36, in fix_command
command = types.Command.from_raw_script(raw_command)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/types.py", line 81, in from_raw_script
expanded = shell.from_shell(script)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/shells/generic.py", line 30, in from_shell
return self._expand_aliases(command_script)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/shells/fish.py", line 65, in _expand_aliases
aliases = self.get_aliases()
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/shells/fish.py", line 60, in get_aliases
raw_aliases = _get_aliases(overridden)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/utils.py", line 33, in wrapper
memo[key] = fn(*args, **kwargs)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/utils.py", line 267, in wrapper
return _cache.get_value(fn, depends_on, args, kwargs)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/utils.py", line 243, in get_value
value = fn(*args, **kwargs)
File "/usr/local/Cellar/thefuck/3.26/libexec/lib/python3.6/site-packages/thefuck/shells/fish.py", line 25, in _get_aliases
name, value = alias.replace('alias ', '', 1).split(' ', 1)
ValueError: not enough values to unpack (expected 2, got 1)
If the bug only appears with a specific application, the output of that application and its version:
N/A
Anything else you think is relevant:
N/A

I've tried the fixes in #717 and am still having the same issue.
I'm having this issue as well, I'm on Mac OS 10.13.4 with The Fuck 3.26 using Python 3.6.5
I managed to reproduce this on a fresh installation (Docker). I'll investigate this ASAP. Thank you for reporting.
Fix is on its way. In the meantime, I guess you can use this temporary fix:
alias fish_key_reader /usr/local/bin/fish_key_reader
Please let me know if it works for you.
Edit: if the temporary fix doesn't work, try redeclaring with (space) every alias declared with = (equal sign):
alias foo echo # declare like this
alias foo=echo # instead of this
ps.: maybe you'd want to clear thefuck's cache with rm ~/.cache/thefuck
The temporary fix works for me after restarting my shell. Thanks!
I have this issue, but I don't think the fix works for me, although I may not be applying it right. I tried adding it to the ~/.config/fish/functions/fuck.fish function, as well as running it separately, and the error was still the same.
Additionally, I have not defined any aliases for my shell, so there are no '=' for me to remove. Running 'alias' returns nothing except for the alias from the temporary fix.
@DmitriK I'm sorry to read that. Maybe you stumbled over another issue? Can you please post the output with the error with THEFUCK_DEBUG set to true and exported? (aka set -x THEFUCK_DEBUG true)
Sure, output follows. I know thefuck was working very recently, as I had run into #730, and everything worked when I fixed the environment variable mentioned in that issue. Something about my setup changed recently to cause this, but I'm not sure exactly what. For what it's worth, I'm on ArchLinux
DEBUG: Run with settings: {'alter_history': True,
'debug': True,
'env': {'GIT_TRACE': '1', 'LANG': 'C', 'LC_ALL': 'C'},
'exclude_rules': [],
'history_limit': None,
'instant_mode': False,
'no_colors': False,
'priority': {},
'repeat': False,
'require_confirmation': True,
'rules': [<const: All rules enabled>],
'slow_commands': ['lein', 'react-native', 'gradle', './gradlew', 'vagrant'],
'user_dir': PosixPath('/home/dmitri/.config/thefuck'),
'wait_command': 3,
'wait_slow_command': 15}
DEBUG: Total took: 0:00:00.100589
Traceback (most recent call last):
File "/usr/bin/thefuck", line 12, in <module>
sys.exit(main())
File "/usr/lib/python3.6/site-packages/thefuck/entrypoints/main.py", line 25, in main
fix_command(known_args)
File "/usr/lib/python3.6/site-packages/thefuck/entrypoints/fix_command.py", line 36, in fix_command
command = types.Command.from_raw_script(raw_command)
File "/usr/lib/python3.6/site-packages/thefuck/types.py", line 81, in from_raw_script
expanded = shell.from_shell(script)
File "/usr/lib/python3.6/site-packages/thefuck/shells/generic.py", line 30, in from_shell
return self._expand_aliases(command_script)
File "/usr/lib/python3.6/site-packages/thefuck/shells/fish.py", line 65, in _expand_aliases
aliases = self.get_aliases()
File "/usr/lib/python3.6/site-packages/thefuck/shells/fish.py", line 60, in get_aliases
raw_aliases = _get_aliases(overridden)
File "/usr/lib/python3.6/site-packages/thefuck/utils.py", line 33, in wrapper
memo[key] = fn(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/thefuck/utils.py", line 267, in wrapper
return _cache.get_value(fn, depends_on, args, kwargs)
File "/usr/lib/python3.6/site-packages/thefuck/utils.py", line 243, in get_value
value = fn(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/thefuck/shells/fish.py", line 25, in _get_aliases
name, value = alias.replace('alias ', '', 1).split(' ', 1)
ValueError: not enough values to unpack (expected 2, got 1)
I did some brute force debugging by adding some logging directly to the fish.py file where the exception occurs. On my system, 'alias_out' is an empty byte string, presumably because I don't generate aliases elsewhere, and a fresh instance of fish is spawned by Popen.
Anyway, I directly applied the diff in the PR to my copy, and that does fix the issue for me since the split length is checked explicitly. I'll keep the patch in there until an official package gets out.
Thanks for your inputs, @DmitriK! I've updated the fix and tests based on them. Also thanks for confirming it works on your side too. Please review and comment on it (#808).
Hi there! I'm hitting something similar too. The alias fish_key_reader fix doesn't seem to work for me. Defined with a space. No other aliases exist. Fish 2.7.1 on MacOS X 10.13.4, using thefuck --HEAD from Homebrew. Output attached, including thefuck debug stuff.
Thanks a million for thefuck btw! Please let me know how I can help.
I grabbed fish.py from commit dba7a8da02281800c2a3e5ed5e6755fd021f05a6 and dropped it in /usr/local/Cellar/thefuck/HEAD-97f2d74/libexec/lib/python3.6/site-packages/thefuck/shells :)
Everything is fine now. Thanks!!
Will this be released (and published to homebrew) soon?
@jrr the fix is included in 3.27, should be available in homebrew soon
Most helpful comment
Fix is on its way. In the meantime, I guess you can use this temporary fix:
Please let me know if it works for you.
Edit: if the temporary fix doesn't work, try redeclaring with
(space) every alias declared with=(equal sign):ps.: maybe you'd want to clear thefuck's cache with
rm ~/.cache/thefuck