nextcloud/server · error · Sabre\DAV\Exception\BadRequest

The {http://nextcloud.com/ns}comp-filter requires a valid na

Error message

The {http://nextcloud.com/ns}comp-filter requires a valid name attribute

What it means

Thrown while deserializing a {http://nextcloud.com/ns}comp-filter element inside a Nextcloud CalDAV search REPORT request: parseAttributes() found no 'name' attribute, so $componentName is not a string and CompFilter::xmlDeserialize() rejects the request with Sabre\DAV\Exception\BadRequest (HTTP 400). The element must carry name="VEVENT"|"VTODO"|"VJOURNAL".

Source

Thrown at apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php:32

use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;

class CompFilter implements XmlDeserializable {

	/**
	 * @param Reader $reader
	 * @throws BadRequest
	 * @return string
	 */
	#[\Override]
	public static function xmlDeserialize(Reader $reader) {
		$att = $reader->parseAttributes();
		$componentName = $att['name'];

		$reader->parseInnerTree();

		if (!is_string($componentName)) {
			throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');
		}

		return $componentName;
	}
}

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Add the required attribute, e.g. <n:comp-filter name="VEVENT"/> with the n namespace bound to http://nextcloud.com/ns
  2. Validate the request body against the Nextcloud search-report XML structure before sending
  3. If you use a client library, upgrade to a version matching the current server's search report format

Example fix

// before
<n:filter><n:comp-filter><n:prop-filter name="SUMMARY"/></n:comp-filter></n:filter>

// after
<n:filter><n:comp-filter name="VEVENT"><n:prop-filter name="SUMMARY"/></n:comp-filter></n:filter>
Defensive patterns

Strategy: validation

Validate before calling

function buildCompFilter(string $name): string {
    if (!in_array($name, ['VEVENT', 'VTODO', 'VJOURNAL'], true)) {
        throw new InvalidArgumentException('comp-filter needs a valid name');
    }
    return "<n:comp-filter name=\"{$name}\"/>";
}

Type guard

function isValidCompFilterName(mixed $name): bool {
    return is_string($name) && in_array($name, ['VEVENT', 'VTODO', 'VJOURNAL'], true);
}

Try / catch

try {
    $client->request('REPORT', $calendarUri, $xmlBody);
} catch (\Sabre\Http\ClientException $e) {
    if ($e->getResponse()?->getStatus() === 400) { /* fix comp-filter name attribute */ }
}

Prevention

When it happens

Trigger: Sending a REPORT with <n:comp-filter/> (or with only children and no name attribute) inside <n:filter> of the {http://nextcloud.com/ns}search-report payload.

Common situations: Hand-built or template-based XML for the Nextcloud calendar search endpoint; clients generated from an outdated schema; attribute lost by an XML serializer that skips empty/blank values.

Related errors


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