phacility/phabricator · error · Exception
Credential has invalid type "%s"!
Error message
Credential has invalid type "%s"!
What it means
Thrown by PassphraseCredentialConduitController when PassphraseCredentialType::getTypeByConstant() fails to resolve the credential's stored type constant to an installed credential type implementation, i.e. the database row references a type that no installed extension provides. Note an upstream quirk: the message formats the already-null $type instead of the stored constant, so you must read $credential->getCredentialType() yourself to learn the real constant.
Source
Thrown at src/applications/passphrase/controller/PassphraseCredentialConduitController.php:33
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$credential) {
return new Aphront404Response();
}
$view_uri = '/K'.$credential->getID();
$token = id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
$viewer,
$request,
$view_uri);
$type = PassphraseCredentialType::getTypeByConstant(
$credential->getCredentialType());
if (!$type) {
throw new Exception(pht('Credential has invalid type "%s"!', $type));
}
$is_locked = $credential->getIsLocked();
if ($is_locked) {
return $this->newDialog()
->setUser($viewer)
->setTitle(pht('Credential Locked'))
->appendChild(
pht(
'This credential can not be made available via Conduit because '.
'it is locked.'))
->addCancelButton($view_uri);
}
if ($request->isFormPost()) {
$xactions = array();
View on GitHub (pinned to 5720a38cfe)
Solutions
- Inspect the stored constant: read $credential->getCredentialType() (credentialType column) for the affected K-object.
- Compare it with the constants from PassphraseCredentialType::getAllTypes() to see what is actually registered in this install.
- Re-enable or reinstall the extension that provides the missing type constant.
- If the type is gone for good, destroy the stale credential and create a new one of a supported type.
Example fix
// before
$type = PassphraseCredentialType::getTypeByConstant(
$credential->getCredentialType());
if (!$type) {
throw new Exception(pht('Credential has invalid type "%s"!', $type));
}
// after: report the actual constant, not the null lookup result
$type_const = $credential->getCredentialType();
$type = PassphraseCredentialType::getTypeByConstant($type_const);
if (!$type) {
throw new Exception(
pht(
'Credential has invalid type "%s"!',
$type_const));
} Defensive patterns
Strategy: validation
Validate before calling
$type_const = $credential->getCredentialType();
$all = PassphraseCredentialType::getAllTypes();
if (empty($all[$type_const])) {
// extension missing: reinstall it or destroy the stale credential
} Type guard
function credential_type_is_installed($credential) {
$all = PassphraseCredentialType::getAllTypes();
return isset($all[$credential->getCredentialType()]);
} Try / catch
try {
$type = PassphraseCredentialType::getTypeByConstant(
$credential->getCredentialType());
} catch (Exception $ex) {
// log the stored constant, then prompt to reinstall the extension
} Prevention
- Audit existing credentials with PassphraseCredentialType::getAllTypes() after disabling any extension.
- Keep the same extension set enabled across environments that share a database.
- Never rename a credential type's CREDENTIAL_TYPE constant without a storage migration.
When it happens
Trigger: Opening /K<id>/conduit (the 'make available via Conduit' workflow, which itself requires a high-security session) for a credential whose credentialType column holds a constant from an uninstalled or removed custom PassphraseCredentialType subclass.
Common situations: A custom credential type class was deleted or renamed during a refactor; a third-party auth extension was deactivated in phabricator config; a database restored from an install that had extra extensions enabled.
Related errors
- Credential "%s" is of unknown type "%s"!
- Credential has invalid type "%s"!
- Credential has invalid type "%s"!
- Credential has invalid type "%s"!
- Credential has invalid type "%s"!
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/8f96a66fe822fb83.
Report an issue: GitHub.