passbolt/passbolt_api · error
The record model is not valid.
Error message
The record model is not valid.
What it means
IgnoreDeleteCommand validates the --model option before deleting an ignore record. If the value is not one of Users, Groups, or DirectoryEntries, it prints 'The record model is not valid.' and returns an error code without touching the database. This is an explicit input-validation guard on the command options.
Solutions
- Pass --model with one of the exact values: Users, Groups, DirectoryEntries (case-sensitive).
- Check the option is not empty/null when invoked from a script.
- Run `passbolt directory_sync ignore --help` to see accepted values.
- Quote the value in shell scripts to avoid word-splitting issues.
Example fix
// before passbolt directory_sync ignore --delete --model=users --id=... // after passbolt directory_sync ignore --delete --model=Users --id=...
Defensive patterns
Strategy: validation
Validate before calling
$allowed = ['Users', 'Groups', 'DirectoryEntries'];
if (!in_array($args->getOption('model'), $allowed, true)) {
throw new \InvalidArgumentException('--model must be exactly one of: ' . implode(', ', $allowed));
} Type guard
function isValidForeignModel(?string $model): bool {
return $model !== null && in_array($model, ['Users', 'Groups', 'DirectoryEntries'], true);
} Try / catch
// this error is not thrown — it is a validation rejection; guard the input instead
if (!Validation::inList($model, ['Users', 'Groups', 'DirectoryEntries'])) {
$io->err(__('The record model is not valid.'));
return $this->errorCode();
} Prevention
- Always pass --model with exact casing: Users, Groups, DirectoryEntries.
- Never omit --model; default it explicitly in scripts.
- Validate inputs in wrapper scripts before shelling out.
- Consult --help output for accepted values.
When it happens
Trigger: Running `passbolt directory_sync ignore --delete` with a --model value outside the allowed in-list (e.g. 'users' lowercase, 'Resource', 'Profile'), or omitting --model so it is null.
Common situations: Typo or wrong casing in the model option; copying command examples for other entities; scripting the command with a variable that is empty.
Understand the failure class
Background: "invalid argument", "unknown mode", "not supported": invalid enum-like argument errors explained — this error's family across 19 libraries.
Related errors
- group(s) returned by your directory are invalid and will be…
- users returned by your directory are invalid and will be…
- $exception->getMessage()
- $message
- $msg
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/b4a64e8b664334be.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltEe/DirectorySync/src/Command/IgnoreDeleteCommand.php:57
'help' => 'The model name (Users, Groups, DirectoryEntries).',
'default' => 'true',
]);
return $parser;
}
/**
* @inheritDoc
*/
public function execute(Arguments $args, ConsoleIo $io): ?int
{
parent::execute($args, $io);
$foreignModel = $args->getOption('model');
$foreignKey = $args->getOption('id');
if (!Validation::inList($foreignModel, ['Groups', 'Users', 'DirectoryEntries'])) {
$io->err(__('The record model is not valid.'));
return $this->errorCode();
}
try {
/** @var \Passbolt\DirectorySync\Model\Table\DirectoryIgnoreTable $DirectoryIgnore */
$DirectoryIgnore = TableRegistry::getTableLocator()->get('Passbolt/DirectorySync.DirectoryIgnore');
$ignored = $DirectoryIgnore->get($foreignKey);
if ($ignored->foreign_model !== $foreignModel) {
throw new RecordNotFoundException(__('The record could not be found.'));
}
$DirectoryIgnore->delete($ignored);
$this->success(__('The record will stop being ignored in the next directory synchronization.'), $io);
return $this->successCode();
} catch (RecordNotFoundException $exception) {
$io->err($exception->getMessage());
return $this->successCode();View on GitHub (pinned to 31c1bbc10f)