Solving the Phabricator HTTP Error 500: Error 1: ** unknown exception encountered, please report by visiting

Once I installed Phabricator and running hg clone over https, I noticed the following error:

hg clone https://test.ixnfo.com/diffusion/1/test/
http authorization required for https://test.ixnfo.com/diffusion/1/test/
realm: Phabricator Repositories
user: test
password: 
destination directory: test
abort: HTTP Error 500: Error 1: ** unknown exception encountered, please report by visiting

hg push https://test.ixnfo.com/diffusion/1/test/
pushing to https://test.ixnfo.com/diffusion/1/test/
http authorization required for https://test.ixnfo.com/diffusion/1/test/
realm: Phabricator Repositories
user: test
password: 
abort: HTTP Error 500: Internal Server Error

At the same time, hg clone was successfully executed via ssh, and also git worked on https and ssh:

hg clone ssh://vcs-user@test.ixnfo.com/diffusion/1/test/
destination directory: test
no changes found
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

hg push ssh://vcs-user@test.ixnfo.com/diffusion/1/test/
pushing to ssh://vcs-user@test.ixnfo.com/diffusion/1/test/
no changes found

The versions were as follows:

phabricator
38694578e1d0c416e992a0fa95edbc270c8af5e8 (Fri, Oct 25)

arcanist
da6d4f85eefb0ae9c945e41659b678549fbb8c8a (Thu, Oct 17)

phutil
39ed96cd818aae761ec92613a9ba0800824d0ab0 (Mon, Sep 30)

php
7.2.19-0ubuntu0.18.04.2

diff
3.6 at /usr/bin/diff

git
2.17.1 at /usr/bin/git

hg
5.2 at /home/phd/phabricator/support/bin/hg

pygmentize
2.2.0 at /usr/bin/pygmentize

svn
Not Available

Apache2 access logs during an error:

"GET /diffusion/4/admin/?cmd=capabilities HTTP/1.1" 401 3554 "-" "mercurial/proto-1.0 (Mercurial 4.5.3)"
"GET /diffusion/4/admin/?cmd=capabilities HTTP/1.1" 200 4021 "-" "mercurial/proto-1.0 (Mercurial 4.5.3)"
"GET /diffusion/4/admin/?cmd=listkeys&namespace=bookmarks HTTP/1.1" 500 319 "-" "mercurial/proto-1.0 (Mercurial 4.5.3)"

Apache2 error logs during error:

EXCEPTION: (Exception) Expected nonempty ‘cmds’ specification! at [/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php:73]
arcanist(head=master, ref.master=da6d4f85eefb), phabricator(head=master, ref.master=38694578e1d0), phutil(head=master, ref.master=39ed96cd818a)
#0 <#2> DiffusionMercurialWireProtocol::isReadOnlyBatchCommand(NULL) called at [/src/applications/diffusion/controller/DiffusionServeController.php:506]
#1 <#2> DiffusionServeController::isReadOnlyRequest(PhabricatorRepository) called at [/src/applications/diffusion/controller/DiffusionServeController.php:279]
#2 <#2> DiffusionServeController::serveRequest(AphrontRequest) called at [/src/applications/diffusion/controller/DiffusionServeController.php:99]
#3 <#2> DiffusionServeController::handleRequest(AphrontRequest) called at [/src/aphront/AphrontController.php:71]
#4 <#2> AphrontController::delegateToController(DiffusionServeController) called at [/src/applications/diffusion/controller/DiffusionController.php:27]
#5 <#2> DiffusionController::willBeginExecution() called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:273]
#6 phlog(Exception) called at [/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
#7 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, Exception) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:750]
#8 AphrontApplicationConfiguration::handleThrowable(Exception) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:298]
#9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:209]
#10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/webroot/index.php:35]
EXCEPTION: (PhutilAggregateException) Encountered a processing exception, then another exception when trying to build a response for the first exception.\n - PhabricatorDataNotAttachedException: Attempting to access attached data on PhabricatorUser (via getUserSetting()), but the data is not actually attached. Before accessing attachable data on an object, you must load and attach it.\n \n Data is normally attached by calling the corresponding needX() method on the Query class when the object is loaded. You can also call the corresponding attachX() method explicitly.\n - Exception: Expected nonempty ‘cmds’ specification! at [/src/aphront/configuration/AphrontApplicationConfiguration.php:318]
arcanist(head=master, ref.master=da6d4f85eefb), phabricator(head=master, ref.master=38694578e1d0), phutil(head=master, ref.master=39ed96cd818a)
#0 <#4> DiffusionMercurialWireProtocol::isReadOnlyBatchCommand(NULL) called at [/src/applications/diffusion/controller/DiffusionServeController.php:506]
#1 <#4> DiffusionServeController::isReadOnlyRequest(PhabricatorRepository) called at [/src/applications/diffusion/controller/DiffusionServeController.php:279]
#2 <#4> DiffusionServeController::serveRequest(AphrontRequest) called at [/src/applications/diffusion/controller/DiffusionServeController.php:99]
#3 <#4> DiffusionServeController::handleRequest(AphrontRequest) called at [/src/aphront/AphrontController.php:71]
#4 <#4> AphrontController::delegateToController(DiffusionServeController) called at [/src/applications/diffusion/controller/DiffusionController.php:27]
#5 <#4> DiffusionController::willBeginExecution() called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:273]
#6 <#3> PhabricatorUser::requireCacheData(string) called at [/src/applications/people/storage/PhabricatorUser.php:375]
#7 <#3> PhabricatorUser::getUserSetting(string) called at [/src/applications/people/storage/PhabricatorUser.php:432]
#8 <#3> PhabricatorUser::getTimezoneIdentifier() called at [/src/applications/people/storage/PhabricatorUser.php:613]
#9 <#3> PhabricatorUser::getTimeZone() called at [/src/applications/people/storage/PhabricatorUser.php:617]
#10 <#3> PhabricatorUser::getTimeZoneOffset() called at [/src/view/page/PhabricatorStandardPageView.php:230]
#11 <#3> PhabricatorStandardPageView::willRenderPage() called at [/src/view/page/AphrontPageView.php:46]
#12 <#3> AphrontPageView::render() called at [/src/applications/base/controller/PhabricatorController.php:286]
#13 <#3> PhabricatorController::willSendResponse(AphrontDialogResponse) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:302]
#14 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [/src/aphront/configuration/AphrontApplicationConfiguration.php:209]
#15 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [/webroot/index.php:35]
#16 phlog(PhutilAggregateException) called at [/src/aphront/response/AphrontUnhandledExceptionResponse.php:32]
#17 AphrontUnhandledExceptionResponse::setException(PhutilAggregateException) called at [/webroot/index.php:46]

Installing nginx also did not solve the problem and there were no errors in the terminal:

printf ‘listkeys\nnamespace 10\n’ | /usr/local/bin/hg -R /var/repo/4/ serve --stdio
0

The problem was solved by adding the following line to the /src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php file:

array_push($parts, ‘httpheader=1024’);

Before:

return implode(’ ', $parts);

And I understand that this problem was back in 2017 and I don’t understand why it has not yet been fixed.

I described the installation of Phabricator in the article:
Install Phabricator on Ubuntu

Leave a comment

Leave a Reply