Leantime/leantime · error · Leantime\Core\Exceptions\MissingParameterException
-32602
-32602
Error message
Client name not specified
What it means
Thrown by Clients::createClient() (JSON-RPC: leantime.rpc.Clients.Clients.createClient) when the $values array has no 'name' key or an empty-string name. The strict check ($values['name'] ?? '') === '' runs after the ClientsPermissions::CREATE gate, so an authorized caller still fails validation. Leantime maps MissingParameterException to JSON-RPC code -32602 (Invalid params).
Source
Thrown at app/Domain/Clients/Services/Clients.php:230
/**
* Creates a new client after validating it and checking for duplicates.
*
* Encapsulates the name-required validation and the duplicate-name check
* that previously lived in the controller.
*
* @param array $values Client data to create (requires a non-empty 'name')
* @return int Id of the newly created client
*
* @throws MissingParameterException When the client name is empty
* @throws EntityExistsException When a client with the same name/street already exists
*
* @api
*/
#[RequiresPermission(ClientsPermissions::CREATE, global: true)]
public function createClient(array $values): int
{
if (($values['name'] ?? '') === '') {
throw new MissingParameterException('Client name not specified');
}
if ($this->isClient($values) === true) {
throw new EntityExistsException('Client exists already');
}
return (int) $this->clientRepository->addClient($values);
}
/**
* Updates an existing client after validating the name is present.
*
* @param array $values Client data including 'id' key (requires a non-empty 'name')
* @return bool Returns true on success, false on failure
*
* @throws MissingParameterException When the client name is empty
*
* @apiView on GitHub (pinned to 9a9f49f100)
Solutions
- Include a non-empty string under values.name in the createClient payload
- Validate and require the name field (trim whitespace) in the form or API client before calling createClient
- Catch MissingParameterException (JSON-RPC -32602) and surface it as a field-level validation error instead of a generic failure
Example fix
// before (JSON-RPC request)
{"jsonrpc":"2.0","method":"leantime.rpc.Clients.Clients.createClient","params":{"values":{"street":"1 Main St"}},"id":1}
// after
{"jsonrpc":"2.0","method":"leantime.rpc.Clients.Clients.createClient","params":{"values":{"name":"Acme Corp","street":"1 Main St"}},"id":1} Defensive patterns
Strategy: validation
Validate before calling
$name = trim((string) ($values['name'] ?? ''));
if ($name === '') {
// refuse before the API call; createClient requires a non-empty name
throw new \InvalidArgumentException('values.name is required');
} Type guard
/** @param array $values @phpstan-assert array{name: non-empty-string} $values */
function hasClientName(array $values): bool
{
return is_string($values['name'] ?? null) && trim($values['name']) !== '';
} Try / catch
try {
$id = $clientsService->createClient($values);
} catch (\Leantime\Core\Exceptions\MissingParameterException $e) {
// JSON-RPC -32602: show a field-level 'name is required' error
$errors['name'] = $e->getMessage();
} Prevention
- Make the client name a required form field validated (with trim) client-side and server-side before calling createClient
- When mapping payloads from external schemas, assert the 'name' key exists and is non-empty before sending
- Treat JSON-RPC -32602 responses as payload bugs to fix at the call site, not server faults
When it happens
Trigger: Calling createClient with {values: {}} or {values: {name: ""}}; submitting the new-client form with a blank name field; sending the name under a different key ('clientName', 'title') because the payload was copied from another schema.
Common situations: Optional form fields where the user can skip the name; integration scripts that map fields 1:1 from an external system and drop 'name'; whitespace-padded input (note: only exactly '' fails — ' ' passes this check but may cause duplicates).
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
AI-assisted analysis of Leantime/leantime@9a9f49f100 (2026-08-21).
Data as JSON: /api/errors/1c16439b93c40165.
Report an issue: GitHub.