Leantime/leantime · error · Leantime\Core\Exceptions\MissingParameterException
-32602
-32602
Error message
First day and last day are required
What it means
Sprints::assertSprintDates() is invoked from both addSprint() (create, line 148) and editSprint() (line 191) and requires that BOTH 'startDate' and 'endDate' are present and non-empty in the params. The loose comparison ($params['startDate'] ?? '') == '' fails for a missing key, null, or empty string; other falsy values like '0' slip through. MissingParameterException maps to JSON-RPC -32602 (Invalid params).
Source
Thrown at app/Domain/Sprints/Services/Sprints.php:255
$this->authorize(SprintsPermissions::DELETE, (int) $sprint->projectId);
}
$this->sprintRepository->delSprint($id);
session(['currentSprint' => '']);
}
/**
* assertSprintDates - ensures the start and end date are both provided.
*
* @param array $params Incoming sprint params.
*
* @throws MissingParameterException When the start or end date is missing.
*/
private function assertSprintDates(array $params): void
{
if (($params['startDate'] ?? '') == '' || ($params['endDate'] ?? '') == '') {
throw new MissingParameterException('First day and last day are required');
}
}
/**
* @throws \Exception
*
* @api
*/
#[RequiresPermission(SprintsPermissions::VIEW)]
public function getSprintBurndown(Models\Sprints $sprint): false|array
{
if (! is_object($sprint)) {
return false;
}
$sprintValues = $this->reportRepository->getSprintReport($sprint->id);
$sprintData = [];View on GitHub (pinned to 9a9f49f100)
Solutions
- Include both startDate and endDate (as parseable date strings) in every addSprint/editSprint payload
- Make both date inputs required in the sprint form and validate before submit
- Catch MissingParameterException (-32602) and highlight the missing date field in the UI
Example fix
// before
$sprintsService->addSprint(['name' => 'Sprint 1', 'startDate' => '2026-08-20']);
// after
$sprintsService->addSprint([
'name' => 'Sprint 1',
'startDate' => '2026-08-20',
'endDate' => '2026-09-03',
]); Defensive patterns
Strategy: validation
Validate before calling
if (trim((string) ($params['startDate'] ?? '')) === '' || trim((string) ($params['endDate'] ?? '')) === '') {
throw new \InvalidArgumentException('Sprint start and end dates are both required');
} Type guard
/** @phpstan-assert array{startDate: non-empty-string, endDate: non-empty-string} $params */
function hasBothSprintDates(array $params): bool
{
return ($params['startDate'] ?? '') !== '' && ($params['endDate'] ?? '') !== '';
} Try / catch
try {
$sprintsService->addSprint($params);
} catch (\Leantime\Core\Exceptions\MissingParameterException $e) {
// -32602: mark both date pickers as required in the dialog
$dialog->flagMissing(['startDate', 'endDate']);
} Prevention
- Make both date pickers required in the sprint dialog and validate before submit
- Send date strings (not null) for both fields even when only one changed
- Applies to BOTH addSprint and editSprint — edit payloads need the dates too
When it happens
Trigger: Creating a sprint from the roadmap without picking both dates; editing a sprint and clearing one of the two date fields; a JSON-RPC addSprint/editSprint call whose payload contains startDate but not endDate (or null instead of a date string).
Common situations: Date pickers left blank in the sprint dialog; frontend forms where one date is optional in the UI but required by the API; payloads built by spreading optional fields that end up null.
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/53fe417ec23fe65a.
Report an issue: GitHub.