XcodesOrg / XcodesOrg/xcodes

Intermittent issue with installing versions

Open
#410 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
4.8k
Forks
182
Avg merge
2d 12h
Merged PRs (30d)
1

Description

I'm experiencing something similar to #406 but without a company-managed Apple ID. Importantly, this is only happening intermittently, but it happens enough to be a blocker in many cases.

There are two commands that are failing intermittently:

  1. xcodes update --data-source apple
  2. xcodes install <version>

In both cases, I see the following error in the terminal:

The operation couldn’t be completed. (DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected character '<' around line 1, column 1." UserInfo={NSDebugDescription=Unexpected character '<' around line 1, column 1., NSJSONSerializationErrorIndex=0}))))

From the error it seems like the endpoint that is being requested is returning HTML instead of JSON. Is there a way we can debug this by printing out the response from Apple's servers? Failing that, what curl command can I use to make a similar request, to see what Apple is returning?

Just to note that I'm also seeing the same issue in the Xcodes app.

Things I've tried:

  • Using xcodes signout and re-authenticating
  • Changing the password in my Apple account
Screenshots Screenshot 2025-01-10 at 13 51 57 Screenshot 2025-01-10 at 13 52 04

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the xcodes update --data-source apple and xcodes install <version> entry points and reproduce the intermittent DecodingError.dataCorrupted response. Inspect the response from Apple's servers, including cases where HTML is returned instead of JSON. Done means the failure is diagnosed and the relevant error handling or debugging output is improved for both CLI commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.