passbolt/passbolt_api · error · CustomValidationException
The tag metadata key data could not be updated.
Error message
The tag metadata key data could not be updated.
What it means
MetadataUpgradeTagsUpdateService::updateData nulls out the V4 metadata props on each tag entity during the V4-to-V5 upgrade and then checks $entity->getErrors(). If the entity carries validation errors after mutation, it throws a CustomValidationException wrapping the per-row errors with this generic message.
Solutions
- Inspect the errors array in the exception payload (keyed by entity index $i) to find which tag row failed and why.
- Fix or clean up the offending tag record (invalid slug/metadata), then re-run the upgrade.
- Re-run the integrity/health checks (passbolt cleanup) before retrying the migration.
Defensive patterns
Strategy: try-catch
Try / catch
try { $upgrader->updateData(); } catch (CustomValidationException $e) { $this->log('Tag upgrade row errors: ' . json_encode($e->getErrors())); } Prevention
- Run data integrity checks (passbolt cleanup) before migration.
- Fix invalid legacy tag records proactively before upgrading.
- Dry-run the upgrade on a staging copy of the database first.
When it happens
Trigger: Running the metadata tags upgrade (updateData) when a tag entity fails validation after its V4 meta props are cleared - e.g. invalid or missing V5 metadata on the entity.
Common situations: Legacy tags with malformed or incomplete data that don't satisfy V5 metadata rules; corrupted tags left by a previously failed upgrade run; running the upgrade command on data modified by older plugin versions.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Tag creation with cleartext metadata not allowed.
- Unable to migrate folder ID
- 400
- 400
- Could not validate the settings.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/8ef9ba1c8eaa6cd8.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/Tags/src/Service/Upgrade/MetadataUpgradeTagsUpdateService.php:72
foreach ($data as $i => $values) {
$tag = $entitiesToUpdate[$values['id']];
$entity = $tagsTable->patchEntity($tag, $values, [
'accessibleFields' => [
'slug' => true,
'metadata_key_id' => true,
'metadata_key_type' => true,
'metadata' => true,
],
'validate' => 'v5',
]);
foreach (MetadataTagDto::V4_META_PROPS as $prop) {
$entity->set($prop, null);
}
if ($entity->getErrors()) {
$errors = [$i => $entity->getErrors()];
throw new CustomValidationException(__('The tag metadata key data could not be updated.'), $errors); // phpcs:ignore
}
$entities[$i] = $entity;
}
try {
$tagsTable->saveManyOrFail($entities, [
IsV4ToV5UpgradeAllowedRule::SKIP_RULE_OPTION => true,
IsSharedMetadataKeyUniqueActiveRule::SKIP_RULE_OPTION => false,
]);
} catch (PersistenceFailedException $exception) { // @phpstan-ignore-line
$this->handleSaveManyValidationException(
$exception,
$entities,
__('The tag metadata key data could not be updated.')
);
} catch (Exception $exception) {
throw new InternalErrorException(View on GitHub (pinned to 31c1bbc10f)