passbolt/passbolt_api · error · BadRequestException
Few fields are missing for the V5.
Error message
Few fields are missing for the V5.
What it means
MetadataFolderDto validates that a v5 folder payload contains all required v5 metadata properties (object_type, id, parent_id, name, etc.). If any are missing, it logs details when debug is on and throws this 400 BadRequestException.
Solutions
- Add all required V5_META_PROPS fields to the folder metadata payload before sending.
- Update the client/passbolt library version so metadata generation matches the server schema.
- Enable debug to read the logged 'Missing fields' list and fix exactly those keys.
- Ensure the metadata JSON is decrypted/parsed correctly and not truncated.
Example fix
// before
metadata = JSON.stringify({object_type: 'FOLDER', name}); // missing id, parent_id...
// after
metadata = JSON.stringify({object_type: 'FOLDER', id: folderUuid, parent_parent_id: parentId, name, created, modified, created_by, modified_by}); Defensive patterns
Strategy: validation
Validate before calling
const V5_META_PROPS = ['object_type','id','parent_id','name','created','modified','created_by','modified_by'];
const missing = V5_META_PROPS.filter(p => meta[p] === undefined || meta[p] === null);
if (missing.length) throw new Error('v5 metadata missing: ' + missing.join(', ')); Type guard
const hasAllV5Props = (m) => V5_META_PROPS.every(p => m?.[p] != null);
Try / catch
try { await api.post('/folders', payload); } catch (e) { if (e.response?.status === 400 && String(e.message).includes('Few fields are missing for the V5')) { console.error('rebuild metadata for folder', folderId); return rebuildAndRetry(); } throw e; } Prevention
- Build v5 metadata via the shared schema/validation helpers, not ad-hoc objects.
- Keep client and server metadata schema versions in sync.
- Validate decrypted metadata JSON against the v5 schema before upload.
- Run with debug enabled during development to see missing-field logs.
When it happens
Trigger: Folder create/update with v5 metadata missing one or more required props (e.g. no 'object_type', missing 'folder_parent_id'/'name' fields in the encrypted metadata JSON).
Common situations: Clients migrating from v4 payloads and dropping required v5 fields; hand-rolled encryption code producing incomplete metadata JSON; schema drift between client and server 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
- Folder can not be shared
- Resource metadata key type is invalid.
- Could not validate folder data.
- Could not validate folder data.
- Could not validate folder data.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/09c7c049b6b6ba72.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Metadata/src/Model/Dto/MetadataFolderDto.php:170
$isV4 = false;
} else {
$v5MissingFields[] = $metadataField;
}
}
if ($isV4) {
return;
}
// Now that we know that we are in v5, we check that all the v5 metadata fields are set
// If all v5 fields are not provided, throw an exception.
if (!empty($v5MissingFields)) {
$msg = __('Few fields are missing for the V5.');
if (Configure::read('debug')) {
Log::error($msg);
Log::error(__('Missing fields: {0}', implode(', ', $v5MissingFields)));
}
throw new BadRequestException($msg);
}
// Now that we know that we have a valid v5 payload, we check that no v4 fields are in the payload
$v4SuperfluousFields = [];
foreach (self::V4_META_PROPS as $v4Field) {
if (array_key_exists($v4Field, $data) && !is_null($data[$v4Field])) {
$v4SuperfluousFields[] = $v4Field;
}
}
if (!empty($v4SuperfluousFields)) {
$msg = __('V4 related fields are not supported for V5.');
if (Configure::read('debug')) {
Log::error($msg);
Log::error(__('Superfluous fields: {0}', implode(', ', $v4SuperfluousFields)));
}
throw new BadRequestException($msg);
}View on GitHub (pinned to 31c1bbc10f)