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

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

Error message

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

What it means

Thrown when a {http://nextcloud.com/ns}prop-filter element in a search REPORT has no name attribute: PropFilter::xmlDeserialize() reads $att['name'], and if it is not a string it rejects the request with Sabre\DAV\Exception\BadRequest (HTTP 400). The name must be the iCal property to search, such as SUMMARY or ATTENDEE.

Source

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

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

class PropFilter 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 . '}prop-filter requires a valid name attribute');
		}

		return $componentName;
	}
}

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Provide the property name: <n:prop-filter name="SUMMARY"/>
  2. Omit the element entirely when no property filter is wanted (note the report then requires at least one prop- or param-filter elsewhere)
  3. Log the outgoing XML body during development to catch attribute-less elements

Example fix

// before
<n:prop-filter/>

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

Strategy: validation

Validate before calling

function buildPropFilter(string $name): string {
    if (!is_string($name) || $name === '') {
        throw new InvalidArgumentException('prop-filter requires name (e.g. SUMMARY)');
    }
    return "<n:prop-filter name=\"{$name}\"/>";
}

Type guard

function isValidPropFilterName(mixed $name): bool {
    return is_string($name) && $name !== ''
        && preg_match('/^[A-Z0-9-]+$/', $name) === 1; // SUMMARY, ATTENDEE, ...
}

Try / catch

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

Prevention

When it happens

Trigger: Sending <n:prop-filter/> (empty) or a prop-filter whose attributes were serialized under a different local name, inside <n:comp-filter>.

Common situations: Dynamic filter builders emitting placeholder elements for unset fields; XML generated with the attribute namespace-bound incorrectly so parseAttributes() does not see it.

Related errors


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