Steps to replicate the issue
- Go to a test/sandbox wiki.
- Create a redirect from [[Bar]] to [[Qux]].
- Create a redirect from [[Foo]] to [[Bar]]. Ignore any errors.
- Go to https://nameofwiki/wiki/Foo.
What happens?
MediaWiki follows the first redirect, from [[Foo]] to [[Bar]], but then stops because [[Bar]] is also a redirect.
- No error is thrown — the user is left to figure out what went wrong.
- The user may want to fix the double redirect if their wiki has no bots performing this task. This requires them to return to Foo with &redirect=no, usually via the “redirected from” message, manually edit the page, and replace the target.
What should happen?
The problematic page is not [[Bar]], which functions normally, but [[Foo]]. It makes little sense to throw an error on [[Bar]]. Therefore, an error should be thrown on [[Foo]].
⚠️ This page is a double redirect to {{{1}}}, which redirects to {{{2}}}. For technical reasons, it does not function. Consider replacing this page's redirect target with {{{2}}}.
However, for the user to actually see that error, the redirection needs to stop on [[Foo]], not [[Bar]] as it does now. To achieve that, the redirector needs to check if its target is itself a redirect, and stop if that's the case.
Stopping here makes it easier to implement a second step, where clicking a link provided by the error message, like:
https://en.wikipedia.org/w/index.php?title={{{1}}}&action=save&newredirtarget={{{2}}}
would replace {{{1}}}'s redirect target with {{{2}}} if the user has the necessary permissions.
Fixing this would also enable related things like throwing errors on broken redirects, and self-redirects T396336: Self-redirect gives blue link to itself but probably shouldn't..
Impact
- MediaWiki has to stop somewhere; stopping on [[Foo]] is equally as inconvenient for the casual visitor as stopping on [[Bar]].
- The actual impact on Wikimedia Foundation wikis is minimal, since WMF wikis have bots to fix double redirects. This proposal mainly affects third-party wikis that lack such bots.
- There may be some negative feedback due to the change from current behaviour because it’s “always been done this way,” but that's not a great reason for doing something — people will get used to this system fairly quickly.
Programming principles
This aligns with key programming and software design principles:
- Clarity and precision: Errors should be reported as close as possible to their cause, making it clear where the problem originates. This simplifies debugging and reduces user confusion.
- Single Source of Truth (SSOT): The problematic redirect resides in [[Foo]], which causes an invalid state by pointing to another redirect. Reporting the error on [[Foo]] preserves the principle that each error or piece of data should have a single authoritative source or location for truth. This reduces duplication of error handling and maintains system consistency. For more on SSOT, see https://en.wikipedia.org/wiki/Single_source_of_truth.
- Fail fast and early: Detecting and reacting to the problem immediately on the page causing it prevents cascading errors and harder-to-trace issues downstream.
- User experience: Users expect that errors relate to the page they accessed. Reporting the error on [[Foo]] aligns with user expectations and facilitates appropriate corrective actions.