nextcloud/server · error · InvalidArgumentException

Please specify a calendar name or --birthday

Error message

Please specify a calendar name or --birthday

What it means

InvalidArgumentException from occ dav:delete-calendar when neither the optional calendar name argument nor the --birthday option was supplied, leaving no deletion target. The command requires exactly one of: a calendar name/URI argument, or --birthday to target the auto-generated birthday calendar.

Source

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

	protected function execute(
		InputInterface $input,
		OutputInterface $output,
	): int {
		/** @var string $user */
		$user = $input->getArgument('uid');
		if (!$this->userManager->userExists($user)) {
			throw new \InvalidArgumentException(
				'User <' . $user . '> is unknown.');
		}

		$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

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Pass the calendar URI as the name argument: occ dav:delete-calendar <uid> <uri>
  2. Or target the birthday calendar explicitly with --birthday
  3. Guard wrappers: require a non-empty name or the --birthday flag before invoking

Example fix

# before: neither a name nor --birthday
occ dav:delete-calendar jdoe
# after: pass the calendar URI or target the birthday calendar
occ dav:delete-calendar jdoe personal
occ dav:delete-calendar jdoe --birthday
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/bash
uid="$1"; name="$2"; birthday="$3" # 'yes' to target the birthday calendar
if [ -z "$name" ] && [ "$birthday" != 'yes' ]; then
  echo 'specify a calendar URI or --birthday' >&2; exit 1
fi
occ dav:delete-calendar "$uid" ${name:+"$name"} ${birthday:+--birthday}

Prevention

When it happens

Trigger: occ dav:delete-calendar <uid> with no name argument and no --birthday flag — e.g. in wrappers that forward optional arguments and end up passing none.

Common situations: Wrapper scripts that pass "$@" with unset optional args; interactive use where the user forgets the second argument; automation templates with empty variables.

Related errors


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