Upgrading Phabricator failed with PhutilMissingSymbolException on ManiphestEditStatusCapability

After upgrading to the latest phabricator (commit 5ba66e56fd54c5050c61fba4d792995071e0b0a4) via sudo ./upgrade.sh, I encountered this error:

Failed to load class or interface ‘ManiphestEditStatusCapability’: the class or interface ‘ManiphestEditStatusCapability’ is not defined in the library map for any loaded phutil library.

This class has now been removed in https://secure.phabricator.com/D19581. And I grepped the source code of phabricator, arcanist, libphutil, phragile and no where in the source references this class ManiphestEditStatusCapability. The only suspicion I have is that this class may be stored in mysql (possibly in binary format).

Now, I have a partially broken phabricator where the home page and maniphest detail page show this error while most other pages are OK.

Hope someone can give me a hint.

Note: This bug has also been reported as a comment at https://secure.phabricator.com/D19581

Also Note: I recently updated my ubuntu machine from 14 to 18 so now the default php version is php7.2 instead of originally php5.

Below is the related apache error log:

[Wed Sep 19 11:45:40.182336 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364] [2018-09-19 11:45:40] EXCEPTION: (PhutilMissingSymbolException) Failed to load class or interface 'ManiphestEditStatusCapability': the class or interface 'ManiphestEditStatusCapability' is not defined in the library map for any loaded phutil library.\n\nIf you are not a developer, this almost always means that a library is out of date. For example, you may have upgraded `phabricator` without upgrading `libphutil`, or vice versa. It might also mean that you need to restart Apache or PHP-FPM. Make sure all libraries are up to date and all services have been restarted.\n\nIf you are a developer and this symbol was recently added or moved, your library map may need to be rebuilt. You can rebuild the map by running 'arc liberate'. For more information, see:\n\nhttps://secure.phabricator.com/book/phabcontrib/article/adding_new_classes/ at [<phutil>/src/__phutil_library_init__.php:25]
[Wed Sep 19 11:45:40.182753 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364] arcanist(head=master, ref.master=2650e8627a20), phabricator(head=master, ref.master=5ba66e56fd54), phutil(head=master, ref.master=3215e4e291ed), sprint(head=master, ref.master=800a5e776027)
[Wed Sep 19 11:45:40.182764 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #0 <#2> __phutil_autoload(string) called at [<phutil>/src/__phutil_library_init__.php:25]
[Wed Sep 19 11:45:40.182768 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #1 <#2> spl_autoload_call(string) called at [<sprint>/application/SprintApplication.php:60]
[Wed Sep 19 11:45:40.182772 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #2 <#2> SprintApplication::getCustomCapabilities() called at [<phabricator>/src/applications/base/PhabricatorApplication.php:587]
[Wed Sep 19 11:45:40.182775 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #3 <#2> PhabricatorApplication::getDefaultObjectTypePolicyMap() called at [<phabricator>/src/applications/policy/query/PhabricatorPolicyQuery.php:420]
[Wed Sep 19 11:45:40.182779 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #4 <#2> PhabricatorPolicyQuery::getDefaultObjectTypePolicyMap() called at [<phabricator>/src/applications/policy/query/PhabricatorPolicyQuery.php:398]
[Wed Sep 19 11:45:40.182782 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #5 <#2> PhabricatorPolicyQuery::getDefaultPolicyForObject(PhabricatorUser, ManiphestTask, string) called at [<phabricator>/src/view/phui/PHUIHeaderView.php:485]
[Wed Sep 19 11:45:40.182786 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #6 <#2> PHUIHeaderView::renderPolicyProperty(ManiphestTask) called at [<phabricator>/src/view/phui/PHUIHeaderView.php:368]
[Wed Sep 19 11:45:40.182789 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #7 <#2> phutil_escape_html(PHUIHeaderView) called at [<phutil>/src/markup/render.php:97]
[Wed Sep 19 11:45:40.182792 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #8 <#2> phutil_tag(string, array, PHUIHeaderView) called at [<phutil>/src/markup/render.php:104]
[Wed Sep 19 11:45:40.182796 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #9 <#2> phutil_tag_div(string, PHUIHeaderView) called at [<phabricator>/src/view/phui/PHUITwoColumnView.php:139]
[Wed Sep 19 11:45:40.182799 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #10 <#2> PHUITwoColumnView::getTagContent() called at [<phabricator>/src/view/AphrontTagView.php:161]
[Wed Sep 19 11:45:40.182802 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #11 <#2> AphrontTagView::render() called at [<phabricator>/src/view/AphrontView.php:222]
[Wed Sep 19 11:45:40.182805 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #12 <#2> AphrontView::producePhutilSafeHTML() called at [<phutil>/src/markup/render.php:111]
[Wed Sep 19 11:45:40.182822 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #13 <#2> phutil_escape_html(PHUITwoColumnView) called at [<phutil>/src/markup/render.php:167]
[Wed Sep 19 11:45:40.182826 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #14 <#2> phutil_implode_html(string, array) called at [<phabricator>/src/view/page/PhabricatorBarePageView.php:58]
[Wed Sep 19 11:45:40.182829 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #15 <#2> PhabricatorBarePageView::willRenderPage() called at [<phabricator>/src/view/page/PhabricatorStandardPageView.php:211]
[Wed Sep 19 11:45:40.182832 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #16 <#2> PhabricatorStandardPageView::willRenderPage() called at [<phabricator>/src/view/page/AphrontPageView.php:46]
[Wed Sep 19 11:45:40.182835 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #17 <#2> AphrontPageView::render() called at [<phabricator>/src/view/page/PhabricatorStandardPageView.php:890]
[Wed Sep 19 11:45:40.182838 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #18 <#2> PhabricatorStandardPageView::produceAphrontResponse() called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:641]
[Wed Sep 19 11:45:40.182841 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #19 <#2> AphrontApplicationConfiguration::produceResponse(AphrontRequest, PhabricatorStandardPageView) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:270]
[Wed Sep 19 11:45:40.182844 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #20 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:181]
[Wed Sep 19 11:45:40.182848 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #21 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:17]
[Wed Sep 19 11:45:40.182851 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #22 phlog(PhutilMissingSymbolException) called at [<phabricator>/src/aphront/response/AphrontUnhandledExceptionResponse.php:20]
[Wed Sep 19 11:45:40.182854 2018] [php7:notice] [pid 3539] [client 192.168.0.227:56364]   #23 AphrontUnhandledExceptionResponse::setException(PhutilMissingSymbolException) called at [<phabricator>/webroot/index.php:21]

I found the cause by examining the stack trace in apache log and found that the error is due to phabricator-extensions-Sprint I installed a long time ago. It is still based on the old capability design. Its source code is not in the same directory as other phabricator sources so grepping did not reveal.

I did not actually use this plugin any more so I simply removed it and also ran ./config delete load-libraries and now it is working well.