{"record":{"id":"30df9450697d9e98","repo":"nextcloud/server","slug":"error-importing-calendar-data-one-or-more-objects-30df94","errorCode":null,"errorMessage":"Error importing calendar data: One or more objects discovered without a UID","messagePattern":"Error importing calendar data: One or more objects discovered without a UID","errorType":"validation","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/CalDAV/Import/ImportService.php","lineNumber":313,"sourceCode":"\t\t\t\t\tif ($type !== $entry->name) {\n\t\t\t\t\t\t$errorMessage = 'One or more objects discovered with multiple base component types';\n\t\t\t\t\t\tif ($options->getErrors() === $options::ERROR_FAIL) {\n\t\t\t\t\t\t\tthrow new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyield new ImportObjectEvent(\n\t\t\t\t\t\t\tdisposition: ImportDisposition::Error,\n\t\t\t\t\t\t\tidentifier: null,\n\t\t\t\t\t\t\terrors: [$errorMessage]\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcontinue 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// determine if the object has a uid\n\t\t\tif (!isset($components[0]->UID)) {\n\t\t\t\t$errorMessage = 'One or more objects discovered without a UID';\n\t\t\t\tif ($options->getErrors() === $options::ERROR_FAIL) {\n\t\t\t\t\tthrow new InvalidArgumentException('Error importing calendar data: ' . $errorMessage);\n\t\t\t\t}\n\t\t\t\tyield new ImportObjectEvent(\n\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);","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/CalDAV/Import/ImportService.php#L295-L331","documentation":"Thrown when the first base component of an imported object has no UID property. The UID is mandatory for VEVENT/VTODO/VJOURNAL per RFC 5545 and is used by the backend to find and deduplicate existing objects, so ImportService refuses such objects when the error mode is ERROR_FAIL. Otherwise it yields an ImportObjectEvent with disposition Error and identifier null.","triggerScenarios":"Importing a calendar object whose VEVENT/VTODO/VJOURNAL lacks a UID line (e.g. 'BEGIN:VEVENT\\nSUMMARY:x\\nEND:VEVENT') while options->getErrors() === CalendarImportOptions::ERROR_FAIL.","commonSituations":"Hand-written test .ics files; data from broken exporters or spreadsheets converted to iCal; lines lost during manual editing or encoding conversions (UID folded or mangled).","solutions":["Add a stable UID to every base component before importing (a UUID is fine, e.g. via \\Sabre\\VObject\\UUIDUtil::getUUID())","Import with errors below ERROR_FAIL and treat the yielded Error events as a skip list, fixing UIDs later","Pre-validate each component with isset($component->UID) before calling import()"],"exampleFix":"// before\nBEGIN:VEVENT\nSUMMARY:Standup\nEND:VEVENT\n\n// after\nBEGIN:VEVENT\nUID:5f9c2b7a-2f4e-4c1a-9d3b-8a1e6f0d7c22\nSUMMARY:Standup\nEND:VEVENT","handlingStrategy":"validation","validationCode":"$v = \\Sabre\\VObject\\Reader::read($ics);\nforeach ($v->getBaseComponents() as $c) {\n    if (!isset($c->UID)) {\n        $c->UID = \\Sabre\\VObject\\UUIDUtil::getUUID();\n    }\n}","typeGuard":"function hasUid(\\Sabre\\VObject\\Component $c): bool {\n    return isset($c->UID) && $c->UID->getValue() !== '';\n}","tryCatchPattern":"try {\n    foreach ($service->import($source, $calendar, $options) as $event) {}\n} catch (\\InvalidArgumentException $e) {\n    // message names the object; assign UIDs in source and retry\n}","preventionTips":["Always generate a UID when creating events programmatically","Add a pre-import check that every base component has a non-empty UID","Re-running an import only deduplicates correctly when UIDs are stable, so never regenerate UIDs on retry"],"tags":["caldav","icalendar","uid","import","nextcloud","php"],"backgroundTag":"icalendar-missing-uid","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}