Skip to content

Fix crash on tab completion when shell is not found - #16021

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
lawik:iex-broker-undefined-shell
Oct 26, 2026
Merged

josevalim merged 1 commit into
elixir-lang:mainfrom
lawik:iex-broker-undefined-shell

Conversation

@lawik

@lawik lawik commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

This fix will let completion fail quietly instead of crashing the entire session when attempting to do completion where Erlang is not finding a valid shell. This was encountered on an SSH-based shell. An upstream improvement to make this find the shell that does exist is also hopefully possible. But Elixir probably shouldn't crash the shell for the sake of a completion.

IEx.Server installs &IEx.Autocomplete.expand/1 as the expand_fun. expand/2 defaults its shell to :shell.whereis/0, which is specced pid() | undefined, and passes it to IEx.Broker.evaluator/1 explicitly - so evaluator/1's own default, shell/0, which maps :undefined to nil, never runs. Process.info/2 then raises ArgumentError in the group process and takes the session down, so Tab completion kills an IEx session whenever whereis has no shell to report: no user_drv, or a user_drv group without one, as on a node started with -noinput.

This fix will let completion fail quietly instead of crashing the entire
session when attempting to do completion where Erlang is not finding a
valid shell.

IEx.Server installs &IEx.Autocomplete.expand/1 as the expand_fun. expand/2
defaults its shell to :shell.whereis/0, which is specced pid() | undefined,
and passes it to IEx.Broker.evaluator/1 explicitly - so evaluator/1's own
default, shell/0, which maps :undefined to nil, never runs. Process.info/2
then raises ArgumentError in the group process and takes the session down,
so Tab completion kills an IEx session whenever whereis has no shell to
report: no user_drv, or a user_drv group without one, as on a node started
with -noinput.
@josevalim
josevalim merged commit 6caa423 into elixir-lang:main Oct 26, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

josevalim pushed a commit that referenced this pull request Oct 26, 2026
This fix will let completion fail quietly instead of crashing the entire
session when attempting to do completion where Erlang is not finding a
valid shell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants