{"record":{"id":"ffce44b63dc6aab8","repo":"nextcloud/server","slug":"error-importing-calendar-data-uid-uid-issue","errorCode":null,"errorMessage":"Error importing calendar data: UID <$uid> - $issues[0]","messagePattern":"Error importing calendar data: UID <\\$uid> - \\$issues\\[0\\]","errorType":"validation","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/CalDAV/Import/ImportService.php","lineNumber":334,"sourceCode":"\t\t\t\t\tdisposition: ImportDisposition::Error,\n\t\t\t\t\tidentifier: null,\n\t\t\t\t\terrors: [$errorMessage]\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$uid = $components[0]->UID->getValue();\n\t\t\t// validate object\n\t\t\tif ($options->getValidate() !== $options::VALIDATE_NONE) {\n\t\t\t\t$issues = $this->componentValidate($vObject, true, 3);\n\t\t\t\tif ($options->getValidate() === $options::VALIDATE_SKIP && $issues !== []) {\n\t\t\t\t\tyield new ImportObjectEvent(\n\t\t\t\t\t\tdisposition: ImportDisposition::Error,\n\t\t\t\t\t\tidentifier: $uid,\n\t\t\t\t\t\terrors: $issues\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t} elseif ($options->getValidate() === $options::VALIDATE_FAIL && $issues !== []) {\n\t\t\t\t\tthrow new InvalidArgumentException('Error importing calendar data: UID <' . $uid . '> - ' . $issues[0]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// create or update object in the data store\n\t\t\t$objectId = $this->backend->getCalendarObjectByUID($principalUri, $uid, $calendarUri);\n\t\t\t$objectData = $vObject->serialize();\n\t\t\ttry {\n\t\t\t\tif ($objectId === null) {\n\t\t\t\t\t$objectId = UUIDUtil::getUUID();\n\t\t\t\t\t$this->backend->createCalendarObject(\n\t\t\t\t\t\t$calendarId,\n\t\t\t\t\t\t$objectId,\n\t\t\t\t\t\t$objectData\n\t\t\t\t\t);\n\t\t\t\t\tyield new ImportObjectEvent(\n\t\t\t\t\t\tdisposition: ImportDisposition::Created,\n\t\t\t\t\t\tidentifier: $uid,\n\t\t\t\t\t);\n\t\t\t\t} else {","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/CalDAV/Import/ImportService.php#L316-L352","documentation":"Thrown when CalendarImportOptions::VALIDATE_FAIL is set and sabre/vobject validation (wrapped by ImportService::componentValidate(), depth 3, 4.0 semantics) reports at least one issue for the object being imported. The message embeds the UID and the first validation issue, e.g. a VEVENT without DTSTART or an invalid RRULE. With the default VALIDATE_SKIP the object is not thrown but yielded as an Error event; VALIDATE_NONE disables the check entirely.","triggerScenarios":"Setting $options->setValidate(CalendarImportOptions::VALIDATE_FAIL) and importing an object that fails \\Sabre\\VObject\\Component::validate(), such as an event missing DTSTART or containing a malformed property.","commonSituations":"Strict import pipelines that upgrade validation from the default VALIDATE_SKIP; importing third-party exports that are loosely RFC-compliant; schema drift after a sabre/vobject upgrade making previously tolerated data invalid.","solutions":["Read the issue named in the message (it names UID and the first problem) and fix that property in the source data","If invalid entries should be skipped rather than abort the import, use VALIDATE_SKIP and filter the yielded Error events","Only use VALIDATE_NONE when the data is known-good and you accept storing non-conformant objects"],"exampleFix":"// before\n$options->setValidate(CalendarImportOptions::VALIDATE_FAIL);\n$service->import($source, $calendar, $options); // throws on first invalid object\n\n// after\n$options->setValidate(CalendarImportOptions::VALIDATE_FAIL);\ntry {\n    foreach ($service->import($source, $calendar, $options) as $event) {}\n} catch (\\InvalidArgumentException $e) {\n    // 'Error importing calendar data: UID <x> - ...' -> fix that object, re-import\n}","handlingStrategy":"validation","validationCode":"$v = \\Sabre\\VObject\\Reader::read($ics);\n$issues = [];\nforeach ($v->getBaseComponents() as $c) {\n    foreach ($c->validate() as $issue) {\n        $issues[] = $issue['message'];\n    }\n}\n// fix $issues before calling import() with VALIDATE_FAIL","typeGuard":null,"tryCatchPattern":"try {\n    foreach ($service->import($source, $calendar, $options) as $event) {}\n} catch (\\InvalidArgumentException $e) {\n    // contains 'UID <x> - <first issue>'; repair that object and re-import\n}","preventionTips":["Choose the validate mode deliberately: FAIL for strict pipelines, SKIP (default) to quarantine bad objects, NONE only for trusted data","Run sabre/vobject validate() in CI for your generated iCal fixtures","Remember import is per-UID idempotent, so re-importing after fixes does not duplicate objects"],"tags":["caldav","icalendar","validation","import","nextcloud","sabre-vobject"],"backgroundTag":"icalendar-validation-failed","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}