nextcloud/server · error · InvalidArgumentException

User <$user> has no calendar named <$name>. You can run occ

Error message

User <$user> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.

What it means

InvalidArgumentException from occ dav:delete-calendar when getCalendarByUri('principals/users/<uid>', <name>) returns null — the user has no calendar with that URI. The name argument is matched against the calendar URI, not the display name, which is the most common cause of the mismatch.

Source

Thrown at apps/dav/lib/Command/DeleteCalendar.php:84

		}

		$birthday = $input->getOption('birthday');
		if ($birthday !== false) {
			$name = BirthdayService::BIRTHDAY_CALENDAR_URI;
		} else {
			/** @var string $name */
			$name = $input->getArgument('name');
			if (!$name) {
				throw new \InvalidArgumentException(
					'Please specify a calendar name or --birthday');
			}
		}

		$calendarInfo = $this->calDav->getCalendarByUri(
			'principals/users/' . $user,
			$name);
		if ($calendarInfo === null) {
			throw new \InvalidArgumentException(
				'User <' . $user . '> has no calendar named <' . $name . '>. You can run occ dav:list-calendars to list calendars URIs for this user.');
		}

		$calendar = new Calendar(
			$this->calDav,
			$calendarInfo,
			$this->l10n,
			$this->config,
			$this->logger
		);

		$force = $input->getOption('force');
		if ($force) {
			$calendar->disableTrashbin();
		}

		$calendar->delete();

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. List the user's calendar URIs with occ dav:list-calendars <uid> and pass the exact uri
  2. If you meant the auto-generated birthday calendar, use --birthday instead of guessing its URI
  3. Confirm the target user is the calendar's owner

Example fix

# before: display name used as URI
occ dav:delete-calendar jdoe 'My Personal Calendar'
# after: look up the URI first, then delete by it
occ dav:list-calendars jdoe   # e.g. shows uri 'personal'
occ dav:delete-calendar jdoe personal
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/bash
uid="$1"; uri="$2"
# resolve URIs first; the command expects the URI, not the display name
occ dav:list-calendars "$uid"
occ dav:delete-calendar "$uid" "$uri"

Prevention

When it happens

Trigger: occ dav:delete-calendar <uid> <name> where name is the human-readable display name (e.g. 'My Personal Calendar') instead of the URI (e.g. 'personal'), or the calendar belongs to a different user / was already deleted.

Common situations: Operators copying the label shown in the calendar UI; URIs changed after a rename; scripts using display names from an export; birthday calendar targeted without --birthday.

Related errors


AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17). Data as JSON: /api/errors/576dbc3cbdbf6130. Report an issue: GitHub.