Skip to content

fix: handle namespaced UnknownContentModelException from newer MediaWiki - #71

Merged
yzqzss merged 5 commits into
saveweb:v4-mainfrom
vitlav:fix-namespaced-unknown-content-model
Nov 25, 2026
Merged

yzqzss merged 5 commits into
saveweb:v4-mainfrom
vitlav:fix-namespaced-unknown-content-model

Conversation

@vitlav

@vitlav vitlav commented Oct 26, 2026

Copy link
Copy Markdown

Problem

On MediaWiki 1.46 (seen on https://wikilivres.ru, which has leftover Module: pages in the Scribunto content model while the extension is disabled), --xmlrevisions aborts with:

mwclient.errors.APIError: ('internal_api_error_MediaWiki\\Content\\UnknownContentModelException', '[...] Caught exception of type MediaWiki\\Content\\UnknownContentModelException', None)

Newer MediaWiki reports the namespaced class name in the error code, while getXMLRevisionsByAllRevisions only compares against internal_api_error_MWUnknownContentModelException, so the existing fallback (retry with arvlimit=1, then without arvprop=content) is never triggered.

Fix

Add error_codes to MWUnknownContentModelException with both the legacy and the namespaced code, and check membership in it.

Testing

With this change the wikilivres.ru dump resumes past the affected revisions; they are logged to errors.log and written as <text deleted="deleted">, as intended by the fallback.

🤖 Generated with Claude Code

Newer MediaWiki reports the error code as
internal_api_error_MediaWiki\Content\UnknownContentModelException,
so the arvlimit=1 / no-content fallback in getXMLRevisionsByAllRevisions
was never triggered and the dump aborted with APIError.
@yzqzss
yzqzss self-requested a review November 10, 2026 15:17
@yzqzss
yzqzss merged commit b8e5933 into saveweb:v4-main Nov 25, 2026
3 checks passed
@yzqzss

yzqzss commented Nov 25, 2026

Copy link
Copy Markdown
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants