When trying to add a new archive type with an extension that is already used by another type, add_archive_type() does not raise an error and instead continues.
add_archive_type()
https://pagure.io/koji/blob/5f0ee908d1fa4fe34f67aec435ccd8eedcf8bcf5/f/kojihub/kojihub.py#_7955
This leads to a different error being raised in get_archive_type() on calls to other methods, as now there are multiple types with the same file extension in the database
get_archive_type()
https://pagure.io/koji/blob/5f0ee908d1fa4fe34f67aec435ccd8eedcf8bcf5/f/kojihub/kojihub.py#_7922
Fixing this requires manually removing the archive type from the database as there is also no dedicated method for removing archive types or modifying their associated extensions.
I can reproduce this by calling add_archive_type(name="debian_changes", description="Debian package changes", extensions="changes") which does not detect that the extension changes is already used by Kiwi changes file
add_archive_type(name="debian_changes", description="Debian package changes", extensions="changes")
changes
Kiwi changes file
On my system, this add_archive_type call is rejected with GenericError: archivetype changes already exists, which sounds like what you expect. So perhaps there is something more to this.
GenericError: archivetype changes already exists
There could be some sort of mismatch between the logic in the get and add calls. The former was adjusted most recently in #4224
Metadata Update from @mikem: - Custom field Size adjusted to None
Would you be willing you share your current archivetypes data? E.g. koji call getArchiveTypes
koji call getArchiveTypes
Sorry for the confusion, I made a typo in the issue. Setting the name to "changes" results in that GenericError being raised. Setting it to something else will not. Try running koji call addArchiveType "debian_changes" "Debian package changes" "changes" instead. The name being the same is caught correctly but the extensions isn't.
koji call addArchiveType "debian_changes" "Debian package changes" "changes"
name
extensions
[evilcica@d2kw774 ~]$ koji call getArchiveTypes | grep -C 1 changes {'compression_type': None, 'description': 'Kiwi changes file', 'extensions': 'changes.xz changes', 'id': 69, 'name': 'changes'}, {'compression_type': None, [evilcica@d2kw774 ~]$ koji call addArchiveType "debian_changes" "Debian package changes" "changes" None [evilcica@d2kw774 ~]$ koji call getArchiveTypes | grep -C 1 changes {'compression_type': None, 'description': 'Kiwi changes file', 'extensions': 'changes.xz changes', 'id': 69, 'name': 'changes'}, {'compression_type': None, -- {'compression_type': None, 'description': 'Debian package changes', 'extensions': 'changes', 'id': 76, 'name': 'debian_changes'}]
Thanks! I see the issue now
This has been broken since 1.32. When this code was updated to use QueryProcessor in #3589 the raw string prefix was dropped on the clause, which broke the needed escaping.
This actually causes false positives as well, since E"\s" yields "s" E.g.
E"\s"
"s"
$ koji call addArchiveType "TEST" "..." "ignature" 2026-01-21 10:19:21,981 [ERROR] koji: GenericError: file extension ignature already exists $ lkoji call addArchiveType "TEST" "..." "pec" 2026-01-21 10:20:30,991 [ERROR] koji: GenericError: file extension pec already exists
Fix in #4531
Metadata Update from @mikem: - Issue set to the milestone: 1.36
Metadata Update from @tkopecek: - Issue tagged with: testing-custom
Metadata Update from @tkopecek: - Issue untagged with: testing-custom - Issue tagged with: testing-basic
Metadata Update from @mfilip: - Issue tagged with: testing-done
Commit 22b275d6 fixes this issue
Commit 365d8ac6 fixes this issue
This issue has been migrated to Fedora Forge: https://forge.fedoraproject.org/koji/koji/issues/4527
Please continue any further discussion there.