https://bugs.kde.org/show_bug.cgi?id=523278
Bug ID: 523278
Summary: New events fail with "Invalid parent collection" and
never self-heal when lastUsedEventCollection points to
a deleted collection id
Classification: Applications
Product: Merkuro
Version First unspecified
Reported In:
Platform: Other
OS: Linux
Status: REPORTED
Severity: minor
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
## Description
Creating a new event fails with *"Invalid parent collection"*, although the
calendars display fine and are writable (the same CalDAV calendars accept new
events from other clients, e.g. an iPhone). The `CreateItem` is sent to a
collection id that no longer exists, and the app never recovers on its own.
Confirmed via akonadiconsole's job tracker: the failing `CreateItem` targets a
collection id absent from the current list. It comes from `[Editor]
lastUsedEventCollection` in `kalendarrc` still holding an id from a previous
incarnation of the resource.
## Steps to reproduce
1. Create one event into a calendar (stores its id in `[Editor]
lastUsedEventCollection` in `~/.config/kalendarrc`).
2. Delete and re-create that calendar's Akonadi resource (e.g. re-add a DAV /
Nextcloud account) — Akonadi assigns **new** collection ids, the stored one
is now gone.
3. Create a new event and save it into any calendar.
## Observed result
*"Invalid parent collection"*, event not created. Explicitly picking the target
calendar does **not** help if the click doesn't change the combo's current
index
(the wanted calendar already being the shown/index-0 entry). Survives restarts,
since nothing rewrites the stale id.
## Expected result
Event is created; a stale/invalid `lastUsedEventCollection` must not block
creation — fall back to a valid writable collection.
## Software/OS versions
- **Operating System:** Arch Linux x86_64
- **KDE Plasma:** 6.7.3
- **KDE Frameworks:** 6.28.0
- **Qt:** 6.11.1
- **Merkuro:** 26.04.3
## Additional information
**Root cause (current master):**
- `calendarconfig.kcfg` stores `[Editor] lastUsedEventCollection` (kcfgfile
`kalendarrc`).
- `IncidenceEditorManager.qml` sets `wrapper.collectionId =
Config.lastUsedEventCollection` when `> -1`, so a new incidence starts on the
stale id.
- `IncidenceEditorPage.qml`'s `FormCollectionComboBox` writes the choice back
only in `onCurrentIndexChanged`; if the index doesn't change, the wrapper
keeps the stale id → invalid parent.
- `CalendarManager::defaultCalendarId()` has a healthy fallback (first writable
collection of matching mime type) but it only runs when
`lastUsedEventCollection == -1`, so a stale-but-nonzero id bypasses it.
**Suggested fix:** validate `lastUsedEventCollection`/`lastUsedTodoCollection`
before use — if it doesn't resolve to a valid collection with `CanCreateItem`
and matching mime type, treat as `-1` so the fallback runs. Also resolve the
wrapper's collection when the editor opens, not only on combo index change.
**Workaround:** quit Merkuro, set `[Editor] lastUsedEventCollection=-1` in
`~/.config/kalendarrc`, restart; first successful save writes a valid id back.
Likely the same root cause as bug 485070, 470517 and 485207.
--
You are receiving this mail because:
You are watching all bug changes.