passbolt/passbolt_api · warning · BadRequestException
V5 metadata format is not enabled.
Error message
V5 metadata format is not enabled.
What it means
Thrown by assertCreationAllowedByMetadataSettings when an entity creation request uses the V5 metadata format while the passbolt.v5.enabled configuration flag is false. The guard blocks V5 creates when the feature is disabled, and callers assert this for resources, folders, and tags.
Solutions
- Set 'passbolt.v5.enabled' => true in config/passbolt.php (or the relevant config file) and clear the cache
- Confirm with Configure::check('passbolt.v5.enabled') that the flag is actually loaded in the failing environment
- Send V4-format metadata from the client if V5 should stay disabled on the server
- After changing config, run the cache clear command so Configure picks up the new value
Example fix
// before (config/passbolt.php)
'passbolt' => [
'v5' => ['enabled' => false],
],
// after
'passbolt' => [
'v5' => ['enabled' => true],
], Defensive patterns
Strategy: try-catch
Validate before calling
if ((bool)Configure::read('passbolt.v5.enabled') === false && $isV5) {
// reject client-side before calling the create endpoint
} Type guard
function isV5Metadata(array $data): bool {
return isset($data['metadata_key_type']) && $data['metadata_key_type'] === 'user_key';
} Try / catch
try {
$this->assertCreationAllowedByMetadataSettings($isV5, 'resource');
} catch (BadRequestException $e) {
// fall back to V4 format creation or inform client V5 is disabled
} Prevention
- Verify passbolt.v5.enabled in config before enabling V5 in clients
- Clear the cache after config changes so Configure reflects new values
- Check env-specific config overrides that may flip the flag
- Keep client and server metadata format settings in sync during upgrades
When it happens
Trigger: Creating a resource/folder/tag with metadata key_type user_key (V5) or otherwise V5-formatted metadata while config passbolt.v5.enabled is false (not set, explicitly false, or loaded from a stale config file).
Common situations: Instance upgraded or config missing the passbolt.v5.enabled flag so it defaults to false while clients send V5 payloads; environment-specific config overriding the flag; clients switched to V5 format before server config updated.
Related errors
- Few fields are missing for the V5.
- Folder can not be shared
- Healthcheck security index endpoint disabled.
- Password expiry is not activated.
- Resource creation with cleartext metadata not allowed.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/6bba3265d985ccb3.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Metadata/src/Utility/MetadataSettingsAwareTrait.php:73
* @throws \Cake\Http\Exception\BadRequestException If v4 tag creation/modification is not allowed.
*/
public function assertV4TagCreationEnabled(): void
{
$this->assertCreationAllowedByMetadataSettings(false, MetadataTypesSettingsDto::ENTITY_TAG);
}
/**
* @param bool $isV5 Format is V5 or not.
* @param string $entity Entity to check for (resource, folder, etc.)
* @return void
* @throws \Cake\Http\Exception\BadRequestException If entity creation/modification is not allowed.
*/
public function assertCreationAllowedByMetadataSettings(bool $isV5, string $entity): void
{
$v5Enabled = Configure::read('passbolt.v5.enabled');
if (!$v5Enabled && $isV5) {
throw new BadRequestException(__('V5 metadata format is not enabled.'));
}
if (!$v5Enabled) {
// No need to assert if format is v4 and v5 config is disabled
return;
}
$settingsDto = MetadataTypesSettingsGetService::getSettings();
if ($isV5) {
if ($entity === MetadataTypesSettingsDto::ENTITY_RESOURCE) {
if (!$settingsDto->isV5ResourceCreationAllowed()) {
throw new BadRequestException(__('Resource creation/modification with encrypted metadata not allowed.')); // phpcs:ignore
}
} elseif ($entity === MetadataTypesSettingsDto::ENTITY_FOLDER) {
if (!$settingsDto->isV5FolderCreationAllowed()) {
throw new BadRequestException(__('Folder creation/modification with encrypted metadata not allowed.')); // phpcs:ignore
}
} elseif ($entity === MetadataTypesSettingsDto::ENTITY_TAG) {View on GitHub (pinned to 31c1bbc10f)