Page MenuHomePhorge

Unknown edge constant "26"! when deleting a file with old attachment edges
Open, Needs TriagePublic

Description

See https://phabricator.wikimedia.org/T318547.

This is because of commit fee8297121f0 which remove the edge type. The edge data could be deleted all together if it's not longer useful, or restore the edge type and delete the edge when the file is deleted, or just suppress the exception.

Event Timeline

Dylsss created this object in space S1 Public.

Hello.

I encountered this, when upgrading from Phabricator, during last step, ./bin/cache purge --all:

~/phabricator$ ./bin/cache purge --all                              
Purging "builtin-file" cache...
[2023-04-21 14:51:05] EXCEPTION: (Exception) Unknown edge constant "26"! at [<phorge>/src/infrastructure/edges/type/PhabricatorEdgeType.php:214]
arcanist(head=stable, ref.stable=42a51e15f4d8), phorge(head=stable, ref.stable=113b17ceca21)
  #0 <#2> PhabricatorEdgeType::getByConstant(string) called at [<phorge>/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php:179]
  #1 <#2> PhabricatorEdgeEditor::buildEdgeSpecs(string, string, string) called at [<phorge>/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php:78]
  #2 <#2> PhabricatorEdgeEditor::removeEdge(string, string, string) called at [<phorge>/src/infrastructure/edges/engineextension/PhabricatorEdgesDestructionEngineExtension.php:32]
  #3 phlog(Exception) called at [<phorge>/src/infrastructure/edges/engineextension/PhabricatorEdgesDestructionEngineExtension.php:39]
  #4 PhabricatorEdgesDestructionEngineExtension::destroyObject(PhabricatorDestructionEngine, PhabricatorFile) called at [<phorge>/src/applications/system/engine/PhabricatorDestructionEngine.php:88]
  #5 PhabricatorDestructionEngine::destroyObject(PhabricatorFile) called at [<phorge>/src/applications/cache/purger/PhabricatorBuiltinFileCachePurger.php:18]
  #6 PhabricatorBuiltinFileCachePurger::purgeCache() called at [<phorge>/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php:78]
  #7 PhabricatorCacheManagementPurgeWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #8 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:377]
  #9 PhutilArgumentParser::parseWorkflows(array) called at [<phorge>/scripts/cache/manage_cache.php:21]
[2023-04-21 14:51:05] EXCEPTION: (Exception) Unknown edge constant "26"! at [<phorge>/src/infrastructure/edges/type/PhabricatorEdgeType.php:214]
arcanist(head=stable, ref.stable=42a51e15f4d8), phorge(head=stable, ref.stable=113b17ceca21)
  #0 <#2> PhabricatorEdgeType::getByConstant(string) called at [<phorge>/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php:179]
  #1 <#2> PhabricatorEdgeEditor::buildEdgeSpecs(string, string, string) called at [<phorge>/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php:78]
  #2 <#2> PhabricatorEdgeEditor::removeEdge(string, string, string) called at [<phorge>/src/infrastructure/edges/engineextension/PhabricatorEdgesDestructionEngineExtension.php:32]
  #3 phlog(Exception) called at [<phorge>/src/infrastructure/edges/engineextension/PhabricatorEdgesDestructionEngineExtension.php:39]
  #4 PhabricatorEdgesDestructionEngineExtension::destroyObject(PhabricatorDestructionEngine, PhabricatorFile) called at [<phorge>/src/applications/system/engine/PhabricatorDestructionEngine.php:88]
  #5 PhabricatorDestructionEngine::destroyObject(PhabricatorFile) called at [<phorge>/src/applications/cache/purger/PhabricatorBuiltinFileCachePurger.php:18]
  #6 PhabricatorBuiltinFileCachePurger::purgeCache() called at [<phorge>/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php:78]
  #7 PhabricatorCacheManagementPurgeWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #8 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:377]
  #9 PhutilArgumentParser::parseWorkflows(array) called at [<phorge>/scripts/cache/manage_cache.php:21]
[2023-04-21 14:51:05] EXCEPTION: (Exception) Unknown edge constant "26"! at [<phorge>/src/infrastructure/edges/type/PhabricatorEdgeType.php:214]
arcanist(head=stable, ref.stable=42a51e15f4d8), phorge(head=stable, ref.stable=113b17ceca21)
  #0 <#2> PhabricatorEdgeType::getByConstant(string) called at [<phorge>/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php:179]
  #1 <#2> PhabricatorEdgeEditor::buildEdgeSpecs(string, string, string) called at [<phorge>/src/infrastructure/edges/editor/PhabricatorEdgeEditor.php:78]
  #2 <#2> PhabricatorEdgeEditor::removeEdge(string, string, string) called at [<phorge>/src/infrastructure/edges/engineextension/PhabricatorEdgesDestructionEngineExtension.php:32]
  #3 phlog(Exception) called at [<phorge>/src/infrastructure/edges/engineextension/PhabricatorEdgesDestructionEngineExtension.php:39]
  #4 PhabricatorEdgesDestructionEngineExtension::destroyObject(PhabricatorDestructionEngine, PhabricatorFile) called at [<phorge>/src/applications/system/engine/PhabricatorDestructionEngine.php:88]
  #5 PhabricatorDestructionEngine::destroyObject(PhabricatorFile) called at [<phorge>/src/applications/cache/purger/PhabricatorBuiltinFileCachePurger.php:18]
  #6 PhabricatorBuiltinFileCachePurger::purgeCache() called at [<phorge>/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php:78]
  #7 PhabricatorCacheManagementPurgeWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #8 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:377]
  #9 PhutilArgumentParser::parseWorkflows(array) called at [<phorge>/scripts/cache/manage_cache.php:21]
Purging "changeset" cache...
Purging "general" cache...
Purging "remarkup" cache...
Purging "user" cache...

Is my installation broken, or can I ignore this error?

For the records, I had the same experience when deleting a repository via ./bin/remove destroy rESHP for Unknown edge constant "25" (not 26 as mentioned in the task title) in downstream https://phabricator.wikimedia.org/T119588

Please share the output of this:

SELECT * FROM phabricator_file.edge WHERE type IN (25, 26);

Other edges have probably been eliminated in the past. For example this one:

f930a43f91548d20ba1974b9b16d7c00723359da

But, in all cases, I don't see that a related migration script was ever created.

So, probably yes, we should restore the edge classes, at least at a minimum versions, without generating any text to the frontend, so to have internal awareness of this edge and don't break removal procedures.

https://we.phorge.it/rPfee8297121f03b2c5018e3149285b53ba6b75910