25

Stack fails with a 404 HTTP status to download a build plan for lts-14.1:

$ stack new my-project

[...]

Downloading lts-14.1 build plan ...
RedownloadInvalidResponse Request {
  host                 = "raw.githubusercontent.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/fpco/lts-haskell/master//lts-14.1.yaml"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 "/home/michid/.stack/build-plan/lts-14.1.yaml" (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Security-Policy","default-src 'none'; style-src 'unsafe-inline'; sandbox"),("Strict-Transport-Security","max-age=31536000"),("X-Content-Type-Options","nosniff"),("X-Frame-Options","deny"),("X-XSS-Protection","1; mode=block"),("X-GitHub-Request-Id","10DA:4457:1D507:285B9:5D55DA2D"),("Content-Length","15"),("Accept-Ranges","bytes"),("Date","Thu, 15 Aug 2019 22:18:21 GMT"),("Via","1.1 varnish"),("Connection","keep-alive"),("X-Served-By","cache-mxp19828-MXP"),("X-Cache","MISS"),("X-Cache-Hits","0"),("X-Timer","S1565907502.529821,VS0,VE176"),("Vary","Authorization,Accept-Encoding"),("Access-Control-Allow-Origin","*"),("X-Fastly-Request-ID","9f869169dd207bbd8bb8a8fd4b274acf6580ba4f"),("Expires","Thu, 15 Aug 2019 22:23:21 GMT"),("Source-Age","0")], responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose})

Everything works fine if I specify --resolver lts-13.19 on the command line so I'm assuming this is a bug.

  • Anything I can do locally to work around this problem?
  • What is the best place to report the issue or check whether it is a known one? I came across https://github.com/commercialhaskell/stack but am not sure whether this is the right place.
michid
  • 10,536
  • 3
  • 32
  • 59

3 Answers3

49

To answer my own question:

Turns out I was using an old version of stack. After upgrading via

stack upgrade 

everything works as expected.

michid
  • 10,536
  • 3
  • 32
  • 59
  • 1
    It would be very useful if you could tell us _why_ that worked, e.g. which version of `stack` you used before, and which newer one fixed it, as we still have that problem [here](https://github.com/nh2/static-haskell-nix/issues/95). – nh2 Jun 19 '20 at 15:00
  • 1
    Maybe [this](https://github.com/commercialhaskell/lts-haskell/issues/247#issuecomment-608669620) leading to [this announcement](https://www.stackage.org/blog/2020/02/discontinuing-legacy-snapshots)? – nh2 Jun 19 '20 at 15:06
4

The error message is confusing because it doesn't say anything about the cause of the 404 error. It might be due to a wrong version of Stack. To check this, type:

stack --version

Not only this command will tell you which version is installed, but it will also tell you what is the most up to date version. If your version is not the most up to date, and moreover if your version is an "unsupported" one, it might display a message such as

Warning: this is an unsupported build that may use different versions of
dependencies and GHC than the officially released binaries, and therefore may
not behave identically.  If you encounter problems, please try the latest
official build by running 'stack upgrade --force-download'.

Just do as indicated and you should be OK:

stack upgrade --force-download

You might get a message saying that there had been an error while copying to /usr/bin, and asking if you want to retry with sudo. Just accept and enter you sudo password.

Check that the new upgraded version is now up to date by typing:

stack -version
  • Thanks for mentioning `stack --version`. This led me to figuring this out eventually. However, the error message is not helpful nor user friendly. There should be a clear message that the current version is not supported any more instead. – michid May 21 '20 at 09:27
  • I really don't know how I ended with a non supported, out of date, hybrid version since I only installed stack about a week ago, on three different computers, all running the same OS (Ubuntu 20.4), following what seemed to me to be the same procedure. I had the problem on two computers and not on the third one. But in any case, it was the error message that made me found the solution. Certainly not friendly, but somewhat helpful, though. – Pierre-Yves Saumont May 22 '20 at 10:08
-1

I had a similar case to OP, but after stack upgrade I still got the error; it went away only after starting a fresh terminal (on macOS).

Danra
  • 9,546
  • 5
  • 59
  • 117