Leantime/leantime · error · \Exception

Calendar could not be retrieved

Error message

Calendar could not be retrieved

What it means

Error "Calendar could not be retrieved" thrown in Leantime/leantime.

Source

Thrown at app/Domain/Calendar/Services/Calendar.php:401

     * @return IcalCalendar The iCal calendar generated from the calendar events.
     *
     * @throws MissingParameterException If either user hash or calendar hash is empty.
     *
     * Not @api: served by the PUBLIC, hash-authenticated /calendar/ical route (no session). The
     * userHash+calHash secrets ARE the credential; exposing it over JSON-RPC would let a caller
     * brute-force feeds. The Ical controller calls it internally.
     */
    public function getIcalByHash(string $userHash, string $calHash): IcalCalendar
    {

        if (empty($userHash) || empty($calHash)) {
            throw new MissingParameterException('userHash and calendar hash are required');
        }

        $calendarEvents = $this->calendarRepo->getCalendarBySecretHash($userHash, $calHash);

        if (! $calendarEvents) {
            throw new \Exception('Calendar could not be retrieved');
        }

        $eventObjects = [];
        // Create array of event objects for ical generator
        foreach ($calendarEvents as $event) {

            try {

                $description = str_replace("\r\n", '\\n', strip_tags($event['description']));

                $currentEvent = IcalEvent::create()
                    ->image(BASE_URL.'/dist/images/favicon.png', 'image/png', Display::badge())
                    ->startsAt(dtHelper()->parseDbDateTime($event['dateFrom'])->setToUserTimezone())
                    ->endsAt(dtHelper()->parseDbDateTime($event['dateTo'])->setToUserTimezone())
                    ->name($event['title'])
                    ->description($description)
                    ->uniqueIdentifier($event['id'])
                    ->url($event['url'] ?? '');

View on GitHub (pinned to 9a9f49f100)

When it happens

Trigger: Thrown at app/Domain/Calendar/Services/Calendar.php:401 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Leantime/leantime@9a9f49f100 (2026-08-21). Data as JSON: /api/errors/d39047c8b67b3439. Report an issue: GitHub.