Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stack new command failing to download build plan for lts-14.1

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.
like image 906
michid Avatar asked Aug 15 '19 22:08

michid


2 Answers

To answer my own question:

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

stack upgrade 

everything works as expected.

like image 57
michid Avatar answered Nov 15 '22 01:11

michid


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
like image 4
Pierre-Yves Saumont Avatar answered Nov 15 '22 01:11

Pierre-Yves Saumont