{"record":{"id":"7ba470eb389fa790","repo":"phacility/phabricator","slug":"credential-s-is-of-unknown-type-s","errorCode":null,"errorMessage":"Credential \"%s\" is of unknown type \"%s\"!","messagePattern":"Credential \"(.+?)\" is of unknown type \"(.+?)\"!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/passphrase/keys/PassphraseAbstractKey.php","lineNumber":38,"sourceCode":"      ->withPHIDs(array($phid))\n      ->needSecrets(true)\n      ->executeOne();\n\n    if (!$credential) {\n      throw new Exception(pht('Failed to load credential \"%s\"!', $phid));\n    }\n\n    return $credential;\n  }\n\n  private function validateCredential(\n    PassphraseCredential $credential,\n    $provides_type) {\n\n    $type = $credential->getImplementation();\n\n    if (!$type) {\n      throw new Exception(\n        pht(\n          'Credential \"%s\" is of unknown type \"%s\"!',\n          $credential->getMonogram(),\n          $credential->getCredentialType()));\n    }\n\n    if ($type->getProvidesType() !== $provides_type) {\n      throw new Exception(\n        pht(\n          'Credential \"%s\" must provide \"%s\", but provides \"%s\"!',\n          $credential->getMonogram(),\n          $provides_type,\n          $type->getProvidesType()));\n    }\n  }\n\n  protected function loadAndValidateFromPHID(\n    $phid,","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/passphrase/keys/PassphraseAbstractKey.php#L20-L56","documentation":"Thrown by PassphraseAbstractKey::validateCredential() when a successfully loaded credential's stored type constant fails to resolve to an implementation via getImplementation(). Unlike the load failure, the row exists and is visible to the viewer, but its type class is not registered in this install — almost always an uninstalled, renamed, or broken custom credential type. The message helpfully includes both the monogram and the offending constant.","triggerScenarios":"Loading a key through loadAndValidateFromPHID() for a credential whose type constant came from a disabled extension; a type class renamed between versions while old rows kept the old constant.","commonSituations":"Disabling a site extension that provided a PassphraseCredentialType; copying a database between installs with different extension sets; upgrading code that changed a type constant without a storage patch.","solutions":["List registered implementations with PassphraseCredentialType::getAllTypes() and compare with the constant in the error message.","Re-enable or reinstall the extension providing that constant.","Migrate the credential to a standard type, or destroy it and create a replacement of a supported type."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$all = PassphraseCredentialType::getAllTypes();\nif (empty($all[$credential->getCredentialType()])) {\n  // extension missing: reinstall it, migrate, or destroy the credential\n}","typeGuard":"function credential_type_is_installed($credential) {\n  $all = PassphraseCredentialType::getAllTypes();\n  return isset($all[$credential->getCredentialType()]);\n}","tryCatchPattern":"try {\n  $key = PassphraseSSHKey::loadFromPHID($phid, $viewer);\n} catch (Exception $ex) {\n  if (preg_match('/unknown type/', $ex->getMessage())) {\n    // reinstall the owning extension or replace the credential\n  }\n}","preventionTips":["Keep custom PassphraseCredentialType classes installed wherever their credentials exist.","Rename type constants only with a matching data migration.","Audit stored constants against getAllTypes() after every extension change."],"tags":["phabricator","passphrase","credentials","extension","configuration"],"backgroundTag":"unknown-credential-type","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}