Hex.Application error trying to run mix deps.get

I tried to run mix deps.get and get this error:

11:33:16.611 \[error\] Task #PID<0.335.0> started from :hex_fetcher terminating
\*\* (SyntaxError) nofile:12:41: unexpected token: }
|
12 |                   oauth_exchange => true},
|                                         ^
(elixir 1.14.5) lib/code.ex:424: Code.validated_eval_string/3
(hex 2.5.0) lib/hex/config.ex:138: Hex.Config.decode_elixir/1
(hex 2.5.0) lib/hex/config.ex:12: Hex.Config.read/0
(hex 2.5.0) lib/hex/config.ex:64: Hex.Config.update/1
(hex 2.5.0) lib/hex/config.ex:161: Hex.Config.update_repos/1
(hex 2.5.0) lib/hex/auth.ex:110: Hex.Auth.persist_oauth_tokens/4
(hex 2.5.0) src/mix_hex_cli_auth.erl:567: :mix_hex_cli_auth.exchange_for_oauth_token/4
Function: #Function<32.44801239/0 in Hex.Registry.Server.prefetch_online/2>
Args: [ ]

Since I only upgraded to local.hex 2.5.0 last week I tried downgrading. SImilar problem. Found that there is a 2.5.1 which sounds like an emergency upissue so tried that. Same prblem. ANy idea what’s going on? I don’t expect this is me, but tell me if there is a workaround?

p.s. I don’t seem to be able to insert a code block with triple ticks. As soon as I type the third one this window hangs. Tried it about three times in different ways before abandoning hope.

mix deps.get

12:45:09.090 \[notice\] Application hex exited: Hex.Application.start(:normal, [ ]) returned an error: shutdown: failed to start child: Hex.State
\*\* (EXIT) an exception was raised:
\*\* (SyntaxError) nofile:12:41: unexpected token: }
|
12 |                   oauth_exchange => true},
|                                         ^
(elixir 1.14.5) lib/code.ex:424: Code.validated_eval_string/3
(hex 2.5.1) lib/hex/config.ex:138: Hex.Config.decode_elixir/1
(hex 2.5.1) lib/hex/config.ex:12: Hex.Config.read/0
(hex 2.5.1) lib/hex/state.ex:170: Hex.State.start_link/1
(stdlib 5.2.3) supervisor.erl:420: :supervisor.do_start_child_i/3
(stdlib 5.2.3) supervisor.erl:406: :supervisor.do_start_child/2
(stdlib 5.2.3) supervisor.erl:390: anonymous fn/3 in :supervisor.start_children/2

12:45:09.108 \[notice\] Application inets exited: :stopped

12:45:09.110 \[notice\] Application ssl exited: :stopped

12:45:09.110 \[notice\] Application public_key exited: :stopped

12:45:09.110 \[notice\] Application asn1 exited: :stopped

12:45:09.110 \[notice\] Application crypto exited: :stopped
Could not start Hex. Try fetching a new version with "mix local.hex" or uninstalling it with "mix archive.uninstall hex.ez"
\*\* (MatchError) no match of right hand side value: {:error, {:hex, {{:shutdown, {:failed_to_start_child, Hex.State, {:EXIT, {%SyntaxError{file: "nofile", line: 12, column: 41, snippet: %{offset: 40, content: "                  oauth_exchange => true},"}, description: "unexpected token: }"}, \[{Code, :validated_eval_string, 3, \[file: 'lib/code.ex', line: 424\]}, {Hex.Config, :decode_elixir, 1, \[file: 'lib/hex/config.ex', line: 138\]}, {Hex.Config, :read, 0, \[file: 'lib/hex/config.ex', line: 12\]}, {Hex.State, :start_link, 1, \[file: 'lib/hex/state.ex', line: 170\]}, {:supervisor, :do_start_child_i, 3, \[file: 'supervisor.erl', line: 420\]}, {:supervisor, :do_start_child, 2, \[file: 'supervisor.erl', line: 406\]}, {:supervisor, :"-start_children/2-fun-0-", 3, \[file: 'supervisor.erl', line: 390\]}\]}}}}, {Hex.Application, :start, \[:normal, [ ]\]}}}}
(hex 2.5.1) lib/hex.ex:5: Hex.start/0
(mix 1.14.5) lib/mix/hex.ex:59: Mix.Hex.start/0
(mix 1.14.5) lib/mix/dep/loader.ex:188: Mix.Dep.Loader.with_scm_and_app/4
(mix 1.14.5) lib/mix/dep/loader.ex:141: Mix.Dep.Loader.to_dep/3
(elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(mix 1.14.5) lib/mix/dep/loader.ex:358: Mix.Dep.Loader.mix_children/2
(mix 1.14.5) lib/mix/dep/loader.ex:18: Mix.Dep.Loader.children/0

Have you tried deleting ~/.hex/hex.config ?
I would also uninstall the hex archive and reinstall it after deleting the config.
Please note that you will loose any previously connected hex account and will need to authenticate to hex again

Lovely. I wasn’t aware of a .hex directory. Deleting the hex.config worked. Interestingly when I ran a deps.get again the hex.config was not recreated, it just seems to have lived without it.

The original file clearly had a syntax error in it, with mismatched braces, so something was poorly installed somewhere along the way.

Can’t I mark this solution as the correct response?

Fixed - this is a new category and it hadn’t been turned on yet. Sorted now :023: