Mercurial keeps returning Error 400: Bad Request
Asked Answered
S

2

8

Anytime I try to do any interaction with the server, Mercurial returns "abort: HTTP Error 400: Bad Request". We are not using any authentication, so that's not an issue. We have three other developers working on the same repo with the same version of mercurial installed (2.2.3). They haven't had any issues, so it makes me think I'm corrupting something in the .hg folder or something. But I really have no clue.

I was able to clone and work from the new directory just fine. However, about 4 hours later, it started happening again in the new directory too. The only things I did in that time period were commit, pull, and push. When I committed a few hours later and tried to pull, that's when I got the error again.

Here is the debug log for incoming (hg --debug --traceback incoming):

using http://myserver/myapp
sending capabilities command
comparing with http://myserver/myapp
query 1; heads
sending batch command
searching for changes
taking initial sample
searching: 2 queries
query 2; still undecided: 208, sample size is: 200
sending known command
Traceback (most recent call last):
File "mercurial\dispatch.pyo", line 88, in _runcatch
File "mercurial\dispatch.pyo", line 740, in _dispatch
File "mercurial\dispatch.pyo", line 514, in runcommand
File "mercurial\dispatch.pyo", line 830, in _runcommand
File "mercurial\dispatch.pyo", line 801, in checkargs
File "mercurial\dispatch.pyo", line 737, in <lambda>
File "mercurial\util.pyo", line 472, in check
File "mercurial\extensions.pyo", line 144, in wrap
File "mercurial\util.pyo", line 472, in check
File "hgext\mq.pyo", line 3528, in mqcommand
File "mercurial\util.pyo", line 472, in check
File "mercurial\commands.pyo", line 3894, in incoming
File "mercurial\hg.pyo", line 513, in incoming
File "mercurial\hg.pyo", line 472, in _incoming
File "mercurial\bundlerepo.pyo", line 342, in getremotechanges
File "mercurial\discovery.pyo", line 45, in findcommonincoming
File "mercurial\setdiscovery.pyo", line 184, in findcommonheads
File "mercurial\wireproto.pyo", line 116, in plain
File "mercurial\wireproto.pyo", line 164, in _submitone
File "mercurial\httppeer.pyo", line 170, in _call
File "mercurial\httppeer.pyo", line 118, in _callstream
File "urllib2.pyo", line 406, in open
File "urllib2.pyo", line 519, in http_response
File "urllib2.pyo", line 444, in error
File "urllib2.pyo", line 378, in _call_chain
File "urllib2.pyo", line 527, in http_error_default
HTTPError: HTTP Error 400: Bad Request
abort: HTTP Error 400: Bad Request

As I said earlier, I can do a clone, but if I try to run incoming, outgoing, pull, or push, I get this error.

Suspiration answered 23/8, 2012 at 13:58 Comment(0)
S
8

I was able to resolve this issue by running

hg rollback

Once I ran that, it uncommitted my files (but kept the changes, so I could see the modified files in hg status). I was then able to run incoming and pull. Then I re-committed my code and pushed it out without any problems.

So something must be getting corrupted when I commit, just not sure why.

Suspiration answered 24/8, 2012 at 13:55 Comment(0)
E
3

I don't know what's the problem in this specific case. But we had a different problem with the same result - incoming and pull commands failed with 400 Bad Request. So here's receipt for how to investigate the failure, in case hg -v --debug doesn't help.

Take Fiddler for capturing and revealing HTTP traffic. Then run mercurial request as following:

hg --config http_proxy.host=127.0.0.1:8888 pull

The config causes redirects of requests through Fiddler, which is listening on port 8888. Then in Fiddler, you may find the red 400 reply and in Inspectors pane to see an entire message, not the code only.

You may look here for details on our problem, investigation and resolution.

Everson answered 28/10, 2014 at 9:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.