Page MenuHomePhorge

Cannot install extension "Diagrams" (Failed to load symbol "DiagramTransactionType")
Closed, ResolvedPublic

Description

I'm just trying to install this lovely extension:

https://we.phorge.it/source/diagrams/

But I get this exception:

EXCEPTION: (PhutilMissingSymbolException) Failed to load symbol "DiagramTransactionType" (of type "class or interface").

Stack trace:

$ phorge> arc liberate
 LOAD ERROR  Failed to load library at location "/var/www/phorge/src". This library is specified by "Configuration (Project Config File (/var/www/phorge/.arcconfig))". Check that the setting is correct and the library is located in the right place.


    Continue without loading library? [y/N] 

[2024-02-27 10:50:22] EXCEPTION: (PhutilMissingSymbolException) Failed to load symbol "DiagramTransactionType" (of type "class or interface").

The class or interface "DiagramTransactionType" is not defined in the library map of any loaded library.

If 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 "arcanist/", 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.

If 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: https://phurl.io/u/newclasses at [<arcanist>/src/init/init-library.php:26]
arcanist(head=master, ref.master=8ef1ead6aca0), phorge(head=master, ref.master=e2bec4c1f58b)
  #0 __phutil_autoload(string) called at [<phorge>/src/extensions/diagrams/src/xaction/DiagramContentTransaction.php:3]
  #1 PhutilBootloader::executeInclude(string) called at [<arcanist>/src/init/lib/PhutilBootloader.php:291]
  #2 PhutilBootloader::loadExtension(string, string, string) called at [<arcanist>/src/init/lib/PhutilBootloader.php:109]
  #3 PhutilBootloader::registerLibrary(string, string) called at [<arcanist>/src/init/lib/core.php:5]
  #4 phutil_register_library(string, string) called at [<phorge>/src/__phutil_library_init__.php:3]
  #5 include_once(string) called at [<arcanist>/src/init/lib/PhutilBootloader.php:251]
  #6 PhutilBootloader::executeInclude(string) called at [<arcanist>/src/init/lib/PhutilBootloader.php:215]
  #7 PhutilBootloader::loadLibrary(string) called at [<arcanist>/src/init/lib/moduleutils.php:40]
  #8 phutil_load_library(string) called at [<arcanist>/src/runtime/ArcanistRuntime.php:457]
  #9 ArcanistRuntime::loadLibrary(ArcanistConfigurationEngine, string, string) called at [<arcanist>/src/runtime/ArcanistRuntime.php:374]
  #10 ArcanistRuntime::loadLibraries(ArcanistConfigurationEngine, ArcanistConfigurationSourceList, PhutilArgumentParser) called at [<arcanist>/src/runtime/ArcanistRuntime.php:104]
  #11 ArcanistRuntime::executeCore(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:37]
  #12 ArcanistRuntime::execute(array) called at [<arcanist>/support/init/init-arcanist.php:6]
  #13 require_once(string) called at [<arcanist>/bin/arc:10]

Additional notes:

$ find -name DiagramTransactionType.php
./src/extensions/diagrams/src/xaction/DiagramTransactionType.php

I also tried this, same error:

$ phorge> arc liberate --clean

Any troubleshooting tip?

Revisions and Commits

Event Timeline

@valerio.bozzolan Are there any prehistoric traces that this extension has been successfully used in the past? :P

[acko@foo phorge (master $%|u=)]$ cd src/extensions/diagrams/
[acko@foo diagrams (master|u=)]$ ../../../../arcanist/bin/arc liberate .
 WORK  Updating library: /var/www/html/phorge/phorge/src/extensions/diagrams/
No library currently exists at the path "/var/www/html/phorge/phorge/src/extensions/diagrams"...
Creating new libphutil library in '/var/www/html/phorge/phorge/src/extensions/diagrams'.
Choose a name for the new library.
    What do you want to name this library? dynamics
Writing '__phutil_library_init__.php' to '/var/www/html/phorge/phorge/src/extensions/diagrams'...
[2024-02-28 10:51:50] EXCEPTION: (XHPASTSyntaxErrorException) src/controller/DiagramController.php: XHPAST Parse Error: syntax error, unexpected ')' on line 919 at [<arcanist>/src/moduleutils/PhutilLibraryMapBuilder.php:461]
arcanist(head=master, ref.master=8ef1ead6aca0)

I can pass that error by randomly (untested!) applying

diff --git a/src/controller/DiagramController.php b/src/controller/DiagramController.php
index 4508f02..939bc14 100644
--- a/src/controller/DiagramController.php
+++ b/src/controller/DiagramController.php
@@ -916,7 +916,7 @@ final class DiagramController extends PhabricatorController {
                     )
                   )
                 ),
-              ),
+/*              ),  COMMENTED to pass arc liberate 20240228 */
               phutil_tag(
                 'script',
                 array(
@@ -936,6 +936,7 @@ final class DiagramController extends PhabricatorController {
             )
           )
         )
+      ) /* ADDED to pass arc liberate 20240228 */
       );
 
     $response = id(new PlainHtmlWebpageResponse())

Afterwards what you're trying to do seems to work here:

[acko@foo phorge (master $%|u=)]$ pwd
/var/www/html/phorge/phorge
[acko@foo phorge (master $%|u=)]$ ./bin/config set load-libraries '["/var/www/html/phorge/phorge/src/extensions/diagrams/"]'
 DONE  Wrote configuration key "load-libraries" to local storage (in file "conf/local/local.json").
[acko@foo phorge (master $%|u=)]$ ../arcanist/bin/arc liberate
 SCAN  Searching for libraries in the current working directory...
 WORK  Updating library: src/
 WORK  Updating library: src/extensions/diagrams/
Done.                                                                         
 DONE  Updated 2 libraries.                                                   
[acko@foo phorge (master $%|u=)]$

Thanks! It worked now! As mentioned in the chat, I'm quite sure that point n.3 and n.4 should be swapped in the README

https://we.phorge.it/source/diagrams/browse/master/README.md;6fa25e4097aa08b2fdbb4204c3c1add1b339f250$8

valerio.bozzolan claimed this task.

Nice :) Thanks