user-switch-command fails to start an iex shell

,

Hello – Elixir newbee here.

Today I’ve learned about the user-switch-command (IEx — IEx v1.18.4), and doing an s iex fails with an error message mentioning set_unicode_state

On the same session, doing an s shell opens an additional Erlang shell, and it works without issue.

Here are all the details from my session (I am on macOS 15.5)

elixir
  1.10.2-otp-22
  1.18.4
 *1.18.4-otp-28
erlang
 *28.0.1

➜  iex
Erlang/OTP 28 [erts-16.0.1] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1]

Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> d = Date.utc_today
~D[2025-06-30]
iex(2)> d
~D[2025-06-30]
iex(3)>
User switch command (enter 'h' for help)
 --> s
 --> j
   1  {iex,start,[[{dot_iex,nil},{on_eof,halt}],{elixir,start_cli,[]}]}
   2* {shell,start,[]}
 --> c

Eshell V16.0.1 (press Ctrl+G to abort, type help(). for help)
1> d.
d
2>
User switch command (enter 'h' for help)
 --> c 1
iex(3)> d
~D[2025-06-30]
iex(4)>
User switch command (enter 'h' for help)
 --> s iex
 --> j
   1  {iex,start,[[{dot_iex,nil},{on_eof,halt}],{elixir,start_cli,[]}]}
   2  {shell,start,[]}
   3* {iex,start,[]}
 --> c
{unknown,{<0.66.0>,set_unicode_state,true}}

Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)
*** ERROR: Shell process terminated! (^G to start new job) ***

14:06:11.669 [error] :gen_statem #PID<0.110.0> terminating
** (MatchError) no match of right hand side value: {#PID<0.66.0>, :set_unicode_state, true}
    (kernel 10.3.1) group.erl:530: :group.handle_info/3
    (stdlib 7.0.1) gen_statem.erl:3748: :gen_statem.loop_state_callback/11
    (stdlib 7.0.1) proc_lib.erl:333: :proc_lib.init_p_do_apply/3
Process Label: {:group, {:iex, :start, []}}
Queue: [info: {#PID<0.66.0>, :set_unicode_state, true}]
Postponed: [info: {#PID<0.66.0>, :activate}]
State: {:server, {:state, :binary, #PID<0.66.0>, true, :none, false, #PID<0.111.0>, :cooked, [], true, &:edlin_expand.expand/2, true, {[], []}, [], :undefined}}
Callback mode: :state_functions, state_enter: false

14:06:11.677 [error] Process #PID<0.111.0> raised an exception
** (ErlangError) Erlang error: :terminated:

  * 1st argument: the device has terminated

    (stdlib 7.0.1) io.erl:202: :io.put_chars(:standard_io, ["Interactive Elixir (1.18.4) - press Ctrl+C to exit (type h() ENTER for help)", 10])
    (iex 1.18.4) lib/iex/server.ex:86: IEx.Server.run_without_registration/3

User switch command (enter 'h' for help)

 --> j
   1  {iex,start,[[{dot_iex,nil},{on_eof,halt}],{elixir,start_cli,[]}]}
   2  {shell,start,[]}

 --> c 1

iex(4)>
User switch command (enter 'h' for help)
 --> c 2
2> d.
d
3>