Higher-versionCode extension updates fail when versionName and JAR filename are unchanged
Summary
An extension with a higher versionCode but unchanged versionName and JAR filename is advertised as updatable, but the installer rejects it as the same version. This also stops Update all at the first affected extension.
Reproduced on v2.3.2363-preview, including a fresh Docker container with no existing database, extension store, reverse proxy, authentication setup, or WebUI involved in the reproduction.
Real-world trigger
The Keiyoushi store currently advertises these legitimate rebuilds:
| Extension | Installed versionCode | New versionCode | Unchanged versionName |
|---|---|---|---|
| Aqua Manga | 65 | 104065 | 1.4.65 |
| Kagane | 31 | 106031 | 1.6.31 |
| Weeb Central | 25 | 106025 | 1.6.25 |
Freshly downloaded official JAR manifests match the store's new codes. This is not an index-versus-package mismatch. The installed records still have the old codes, and the destination filenames collide.
Five other extensions with changed version names updated successfully individually. Uploading the same official bytes for the three affected extensions under unique filenames also succeeded, leaving all eight installed extensions with no pending updates after reloading the browser.
Reproduction
The Python 3 standard-library script below was run successfully on Linux with Docker. It launches a disposable container bound only to an ephemeral loopback port, uses no production volumes, and stops its own container afterward.
It downloads a specific official Aqua Manga JAR, then creates a synthetic old-version fixture by changing only android:versionCode="104065" to "65" in AndroidManifest.xml. The filename and versionName remain identical. The fixture is only used in the disposable reproduction container; it is not presented as a historical upstream release.
What the script does
The script isolates the installer’s filename-collision bug: a higher-versionCode update fails under the original filename, but the exact same bytes succeed under a different filename.
- Downloads the official Aqua Manga JAR.
- Creates a synthetic older copy by lowering only its manifest versionCode, leaving versionName unchanged.
- Starts a disposable Suwayomi container with fresh storage and a loopback-only port.
- Installs the older fixture using the canonical filename — HTTP 200.
- Uploads the official newer JAR using that same filename — HTTP 500.
- Uploads identical official bytes using a unique filename — HTTP 200.
- Saves the responses and container logs, then stops and removes the test container.
The comparison between steps 5 and 6 shows that the filename determines whether the update succeeds. The script does not mount or modify a production installation.
Save as repro.py and run python3 repro.py:
import io
import json
import pathlib
import subprocess
import tempfile
import time
import urllib.error
import urllib.request
import zipfile
SERVER_IMAGE = (
"ghcr.io/suwayomi/suwayomi-server:v2.3.2363-preview"
"@sha256:382e5dac9924efddcc49a258be93bb173b6e1976f6a69e434f61e14acd00bf5c"
)
EXTENSION_URL = (
"https://github.com/keiyoushi/extensions/releases/download/19c8e5f-0/"
"tachiyomi-en.aquamanga-v1.4.65.jar"
)
CANONICAL_FILENAME = "tachiyomi-en.aquamanga-v1.4.65.jar"
RENAMED_FILENAME = "tachiyomi-en.aquamanga-v1.4.65-code104065.jar"
def run_docker(*arguments):
return subprocess.check_output(["docker", *arguments], text=True).strip()
def create_old_version_fixture(current_jar):
"""Lower only the manifest versionCode; keep the versionName unchanged."""
output_buffer = io.BytesIO()
with zipfile.ZipFile(io.BytesIO(current_jar)) as source_archive:
with zipfile.ZipFile(output_buffer, "w") as fixture_archive:
for entry in source_archive.infolist():
entry_contents = source_archive.read(entry.filename)
if entry.filename == "AndroidManifest.xml":
assert b'android:versionCode="104065"' in entry_contents
entry_contents = entry_contents.replace(
b'android:versionCode="104065"',
b'android:versionCode="65"',
)
fixture_archive.writestr(entry, entry_contents)
return output_buffer.getvalue()
def send_request(server_url, path, body=None, headers=None):
request = urllib.request.Request(
server_url + path, data=body, headers=headers or {}
)
try:
with urllib.request.urlopen(request, timeout=60) as response:
return response.status, response.read().decode()
except urllib.error.HTTPError as error:
# HTTP 500 is the expected reproduction result; record its body too.
return error.code, error.read().decode()
def wait_for_server(server_url):
for attempt in range(90):
try:
status, _ = send_request(server_url, "/health")
if status == 200:
return
except (urllib.error.URLError, TimeoutError, ConnectionError):
# Connection failures are expected while the container starts.
pass
time.sleep(1)
raise RuntimeError("Suwayomi did not become healthy during startup")
def upload_extension(server_url, step_name, jar_contents, upload_filename):
boundary = "suwayomi-extension-repro-boundary"
multipart_header = (
f"--{boundary}\r\n"
'Content-Disposition: form-data; name="file"; '
f'filename="{upload_filename}"\r\n'
"Content-Type: application/java-archive\r\n\r\n"
).encode()
multipart_body = (
multipart_header + jar_contents + f"\r\n--{boundary}--\r\n".encode()
)
status, response_body = send_request(
server_url,
"/api/v1/extension/install",
body=multipart_body,
headers={"Content-Type": f"multipart/form-data; boundary={boundary}"},
)
extension_listing = send_request(server_url, "/api/v1/extension/list")
result = {
"label": step_name,
"status": status,
"response": response_body,
"listing": extension_listing,
}
print(json.dumps(result, indent=2), flush=True)
return result
def main():
output_directory = pathlib.Path(tempfile.mkdtemp(prefix="suwayomi-repro-"))
container_name = output_directory.name
container_started = False
with urllib.request.urlopen(EXTENSION_URL, timeout=60) as response:
current_jar = response.read()
old_version_jar = create_old_version_fixture(current_jar)
(output_directory / CANONICAL_FILENAME).write_bytes(current_jar)
(output_directory / "old-code65.jar").write_bytes(old_version_jar)
results = {
"directory": str(output_directory),
"image": SERVER_IMAGE,
"url": EXTENSION_URL,
"steps": [],
}
print(f"Evidence directory: {output_directory}", flush=True)
try:
# Use fresh container storage and an ephemeral loopback-only port.
run_docker(
"run", "--rm", "-d", "--name", container_name,
"-p", "127.0.0.1::4567", "-e", "TZ=Etc/UTC", SERVER_IMAGE,
)
container_started = True
port_mapping = run_docker("port", container_name, "4567/tcp")
server_port = port_mapping.rsplit(":", 1)[1]
server_url = f"http://127.0.0.1:{server_port}"
wait_for_server(server_url)
# Establish the old installed code under the canonical filename.
results["steps"].append(
upload_extension(
server_url, "install-old-code65", old_version_jar, CANONICAL_FILENAME
)
)
# Higher code, unchanged filename: reproduces the HTTP 500 failure.
results["steps"].append(
upload_extension(
server_url, "update-current-same-filename", current_jar, CANONICAL_FILENAME
)
)
# Identical official bytes, different filename: demonstrates the workaround.
results["steps"].append(
upload_extension(
server_url, "update-current-renamed", current_jar, RENAMED_FILENAME
)
)
finally:
results_path = output_directory / "results.json"
try:
results_path.write_text(json.dumps(results, indent=2), encoding="utf-8")
if container_started:
container_log = run_docker("logs", container_name)
(output_directory / "container.log").write_text(
container_log, encoding="utf-8"
)
finally:
# Stop only the container created by this run; --rm removes it.
if container_started:
subprocess.run(["docker", "stop", container_name], check=True)
print(f"Results: {results_path}", flush=True)
if __name__ == "__main__":
main()Verified results
| Operation | HTTP status | versionCode reported by /api/v1/extension/list |
|---|---|---|
| Install synthetic old fixture, canonical filename | 200 | 65 |
| Upload official code-104065 JAR, same canonical filename | 500 | 65 |
Upload identical official bytes as tachiyomi-en.aquamanga-v1.4.65-code104065.jar |
200 | 104065 |
The official JAR SHA-256 used in the test was 34f3d2f9d50d68266233f39946baca14159ed4463efc280da0a3645000587d1a.
The failing request logs:
java.lang.IllegalStateException: Extension can't be updated to the same version. Reinstall the extension instead
at suwayomi.tachidesk.manga.impl.extension.Extension.installExtension(Extension.kt:451)
at suwayomi.tachidesk.manga.impl.extension.Extension.installExternalExtension(Extension.kt:165)The real-world Update all GraphQL request produces the same exception at Extension.kt:451.
Expected behavior
A higher versionCode should be installable even when versionName and the incoming filename are unchanged. The installer should safely replace/reload the artifact and persist the new metadata, without requiring an uninstall or a manual filename workaround.
Likely cause
In Extension.kt at current master dba836b, the installer calls prepareJarAndIcons, gets the old JAR path, and rejects equality of the absolute paths as a same-version update. The test compares paths, not versionCode. prepareJarAndIcons also runs before this guard and before blockJarUsageWhile, so the failed update can already have replaced the on-disk artifact while leaving installed metadata unchanged.
A possible fix is to stage updates under unique paths that include versionCode and perform replacement under the existing JAR-use coordination. The report does not assume a particular implementation.
Environment and scope
- Server: v2.3.2363-preview; pinned image digest is in the script.
- Database: fresh default H2.
- Container OS: Ubuntu 24.04.4 LTS, x86_64.
- JVM: Temurin OpenJDK 25.0.3+9 LTS.
- Minimal reproduction client: Python 3 HTTP requests; no browser or WebUI required.
- Original symptom: Suwayomi-WebUI extension page, Update all.
- Checked current Server/WebUI preview changelogs and existing issues for this error; no matching fix found. The fresh-container test isolates this from user configuration.
Workaround verified: external-install the unchanged official JAR with a unique filename containing the same versionName and new versionCode. No library deletion, source uninstall, database edits, or server patch was needed.
Source: Suwayomi/Suwayomi-Server