{"record":{"id":"4fdb49a2936bc31b","repo":"nextcloud/server","slug":"the-http-nextcloud-com-ns-comp-filter-requires","errorCode":null,"errorMessage":"The {http://nextcloud.com/ns}comp-filter requires a valid name attribute","messagePattern":"The (.+?)comp-filter requires a valid name attribute","errorType":"http","errorClass":"Sabre\\DAV\\Exception\\BadRequest","httpStatus":400,"severity":"error","filePath":"apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php","lineNumber":32,"sourceCode":"use Sabre\\Xml\\Reader;\nuse Sabre\\Xml\\XmlDeserializable;\n\nclass CompFilter implements XmlDeserializable {\n\n\t/**\n\t * @param Reader $reader\n\t * @throws BadRequest\n\t * @return string\n\t */\n\t#[\\Override]\n\tpublic static function xmlDeserialize(Reader $reader) {\n\t\t$att = $reader->parseAttributes();\n\t\t$componentName = $att['name'];\n\n\t\t$reader->parseInnerTree();\n\n\t\tif (!is_string($componentName)) {\n\t\t\tthrow new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}comp-filter requires a valid name attribute');\n\t\t}\n\n\t\treturn $componentName;\n\t}\n}\n","sourceCodeStart":14,"sourceCodeEnd":38,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/CalDAV/Search/Xml/Filter/CompFilter.php#L14-L38","documentation":"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\".","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the required attribute, e.g. <n:comp-filter name=\"VEVENT\"/> with the n namespace bound to http://nextcloud.com/ns","Validate the request body against the Nextcloud search-report XML structure before sending","If you use a client library, upgrade to a version matching the current server's search report format"],"exampleFix":"// before\n<n:filter><n:comp-filter><n:prop-filter name=\"SUMMARY\"/></n:comp-filter></n:filter>\n\n// after\n<n:filter><n:comp-filter name=\"VEVENT\"><n:prop-filter name=\"SUMMARY\"/></n:comp-filter></n:filter>","handlingStrategy":"validation","validationCode":"function buildCompFilter(string $name): string {\n    if (!in_array($name, ['VEVENT', 'VTODO', 'VJOURNAL'], true)) {\n        throw new InvalidArgumentException('comp-filter needs a valid name');\n    }\n    return \"<n:comp-filter name=\\\"{$name}\\\"/>\";\n}","typeGuard":"function isValidCompFilterName(mixed $name): bool {\n    return is_string($name) && in_array($name, ['VEVENT', 'VTODO', 'VJOURNAL'], true);\n}","tryCatchPattern":"try {\n    $client->request('REPORT', $calendarUri, $xmlBody);\n} catch (\\Sabre\\Http\\ClientException $e) {\n    if ($e->getResponse()?->getStatus() === 400) { /* fix comp-filter name attribute */ }\n}","preventionTips":["Centralize search-report XML construction in one builder that asserts required attributes","Bind the n: prefix to http://nextcloud.com/ns exactly","Capture a known-good payload from the web UI as a regression fixture"],"tags":["caldav","xml","search","webdav","nextcloud","bad-request","report"],"backgroundTag":"webdav-400-bad-request","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}