importchannel network command does not import newer channel versions if local database copy already exists
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: TBD
Observed behavior
Running kolibri manage importchannel network <channel_id> successfully imports a channel. After a new version of the channel is published on Studio, running the same command again fails silently — it does not import the new version and logs:
Version 2 of channel <channel_id> already exists in database; cancelling import of version 2
The root cause is that the channel's SQLite database file was already downloaded to disk (e.g. ~/.kolibri/content/databases/<channel_id>.sqlite3) during the first import. On a subsequent import, FileTransfer detects the file already exists and does not overwrite it, so the channel import manager reads the stale database and concludes the version is already present.
Errors and logs
Version 2 of channel <channel_id> already exists in database; cancelling import of version 2
Expected behavior
Running kolibri manage importchannel network <channel_id> should detect when a newer version of the channel is available on the remote source (Studio, peer Kolibri, or USB), download the updated database file — overwriting the local copy — and complete the import with the new version.
User-facing consequences
Admins and educators are unable to receive updated channel content after a new version is published on Studio. Re-running the import command silently skips the update, leaving the locally stored content outdated.
Steps to reproduce
- Run
kolibri manage importchannel network <channel_id>to import a channel. - Publish a new version of the same channel on Kolibri Studio.
- Run the same command again:
kolibri manage importchannel network <channel_id>. - Observe that the import is cancelled and the new version is not imported.
Context
- Kolibri version: 0.19.3
- Operating system: Any
Acceptance Criteria
- [ ] Running
kolibri manage importchannel network <channel_id>when a newer version of the channel is available on the remote source fetches the updated channel database, overwriting the local copy. - [ ] Running the same command when the locally imported version is already up to date does not re-download or re-import the channel database.
- [ ] A test covers the case where a channel with an outdated local database is re-imported and the new version is applied.
AI usage
I used Claude to help draft this issue from my description of the bug. I reviewed and edited the content for accuracy.
Hello. I posted this issue on the community forum in April (see here). My organization plans to utilize the cli commands for bulk import/update channels on hundreds of kolibri instances across the country, remotely.
Any updates on when is a fix planned for this bug?
Plan: kolibri manage importchannel network <id> downloads and imports a newer remote channel version over an existing local database, and skips the download when the imported version is already current.
- [ ] An outdated local channel database is replaced on network import
- [ ] Skip the download when the imported version is current
- [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
- Fix scoped to
transfer_channel;remoteimport's channel-DB step keeps reusing a local file — if it must also refresh, "import more resources" would start upgrading channels. - A UUID import now calls the lookup endpoint; a server without it that errors (not 404) fails with
CommandErrorinstead of downloading. - A UUID whose lookup returns no listing downloads unconditionally — if Studio does list private channels by ID, those would also get the skip.
- A draft listing (
version: None) always re-downloads — if drafts carry a comparable version, they could skip too. - The up-to-date skip also applies with
--no_upgrade— if users rely on it to pre-stage an identical DB, it no longer writes the upgrade file. - A leftover upgrade DB from
--no_upgradeor an unapplied diff is still copied in preference to downloading (channel_transfer.py:165) — if that should be version-checked too, Task 2 grows a second comparison.
Written by rtibblesbot, an LLM-based coding agent.