Composer [UnexpectedValueException] error will trying to use composer to install a github project

I started getting a similar error and the reason was that Github recently changed the format of their auth tokens:

To resolve the error:

  1. Find the composer/auth.json file (if you’re running the project in a container, you’ll have to bash into it and find the file in there)
  2. Remove its entry. Your file will probably look like the following after removing the entry: {"github-oauth": {}}
  3. Run composer self-update. The issue got resolved in version 2.0.12. See the first item in the changelog for that version here:

After that, you can restore your composer/auth.json file to its initial state as the newer version of composer will recognize the new key format.

Leave a Comment