Skip to content

fix(server): baixa Paper via API fill v3 (v2 sunset -> jar corrompido)#6

Open
oTalentz wants to merge 1 commit into
mainfrom
devin/1784624691-fix-paper-download-dockerfile
Open

fix(server): baixa Paper via API fill v3 (v2 sunset -> jar corrompido)#6
oTalentz wants to merge 1 commit into
mainfrom
devin/1784624691-fix-paper-download-dockerfile

Conversation

@oTalentz

@oTalentz oTalentz commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

O container mc-server-1218 estava em crash-loop (Error: Invalid or corrupt jarfile paper-1.21.8.jar). Causa raiz: o Dockerfile ainda baixava o Paper pela API v2 (api.papermc.io/v2/.../downloads/paper-...jar), que foi descontinuada (sunset) e agora responde 404 com um corpo JSON. Esse JSON era salvo como paper-1.21.8.jar, gerando um jar inválido.

O scripts/setup.sh já havia sido migrado para a API fill v3, mas o Dockerfile (usado pelo docker compose, método principal de start) e o scripts/setup.bat ficaram para trás.

Correção — buscar os metadados em fill.papermc.io/v3 e extrair a URL real (fill-data.papermc.io), igual ao setup.sh:

- curl -L -o paper-${PAPER_VERSION}.jar \
-   "https://api.papermc.io/v2/projects/paper/versions/${PAPER_VERSION}/builds/latest/downloads/paper-${PAPER_VERSION}.jar"
+ PAPER_META=$(curl -sL "https://fill.papermc.io/v3/projects/paper/versions/${PAPER_VERSION}/builds/latest")
+ PAPER_URL=$(echo "$PAPER_META" | grep -oE 'https://fill-data[^"]+\.jar' | head -1)
+ [ -n "$PAPER_URL" ] || exit 1
+ curl -L -o paper-${PAPER_VERSION}.jar "$PAPER_URL"
+ unzip -tqq paper-${PAPER_VERSION}.jar   # falha o build cedo se o jar vier corrompido

setup.bat recebeu a mesma migração via Invoke-RestMethod + $meta.downloads.'server:default'.url.

Verificação

docker compose up -d --build sobe o container healthy; log mostra Done (12.993s)! For help com ViaVersion 5.3.0 e ViaBackwards carregados.

Link to Devin session: https://app.devin.ai/sessions/d06d0613f3eb498586bc6d3bea1dcaf1

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Paper server downloads by switching to the current PaperMC download service.
    • Added download verification to ensure the server JAR is valid before use.
    • Updated setup scripts to reliably retrieve the latest build for the selected Paper version.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Paper server jar downloads now use PaperMC’s fill API v3 metadata in both Docker and Windows setup flows. Docker adds URL validation, jar verification, and package cleanup.

Changes

Paper download flow

Layer / File(s) Summary
Migrate Paper downloads to API v3
Dockerfile, scripts/setup.bat
Both paths query PaperMC fill API v3, extract the server jar URL, and download the requested Paper version. Docker also validates the jar and removes temporary packages and apt metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título descreve claramente a mudança principal: migração do download do Paper da API v2 para a Fill v3 para evitar JAR inválido.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devin/1784624691-fix-paper-download-dockerfile

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
Dockerfile (1)

25-30: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Bound the API calls and surface HTTP failures.

Both curl invocations lack explicit failure handling, retries, and timeouts. A transient outage can obscure the HTTP error or leave the image build waiting indefinitely. Add --fail --show-error --retry, connection timeouts, and a maximum transfer time to both requests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 25 - 30, Update both curl invocations in the
Dockerfile Paper download step to include HTTP failure reporting, retries,
connection timeouts, and maximum transfer-time limits. Apply the same bounded
options to the metadata request and the final JAR download while preserving the
existing URL extraction and error handling flow.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Around line 27-31: Verify the downloaded Paper JAR’s SHA-256 digest against
downloads."server:default".checksums.sha256 before it is accepted or used:
update the Dockerfile download flow near unzip -tqq and add the equivalent check
in scripts/setup.bat near the JAR download. Preserve the existing failure
behavior and reject the artifact when the digest does not match.

In `@scripts/setup.bat`:
- Around line 35-36: Update the PowerShell download command in the setup script
to retrieve and validate Paper’s checksums.sha256 against the downloaded file
before reporting success. Use the metadata/download URL flow around
PAPER_VERSION and PAPER_JAR, ensure a hash mismatch fails the setup, and only
continue after a successful integrity check.

---

Nitpick comments:
In `@Dockerfile`:
- Around line 25-30: Update both curl invocations in the Dockerfile Paper
download step to include HTTP failure reporting, retries, connection timeouts,
and maximum transfer-time limits. Apply the same bounded options to the metadata
request and the final JAR download while preserving the existing URL extraction
and error handling flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cfa78c96-6b94-4678-87c8-6c9f28c1d30f

📥 Commits

Reviewing files that changed from the base of the PR and between e28abc0 and 9e0c6dd.

📒 Files selected for processing (2)
  • Dockerfile
  • scripts/setup.bat

Comment thread Dockerfile
Comment on lines +27 to +31
PAPER_URL=$(echo "$PAPER_META" | grep -oE 'https://fill-data[^"]+\.jar' | head -1) && \
if [ -z "$PAPER_URL" ]; then echo "ERRO: nao foi possivel obter a URL do Paper ${PAPER_VERSION}" >&2; exit 1; fi && \
echo "Baixando Paper de: $PAPER_URL" && \
curl -L -o paper-${PAPER_VERSION}.jar "$PAPER_URL" && \
unzip -tqq paper-${PAPER_VERSION}.jar > /dev/null && \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== Files ==\n'
git ls-files Dockerfile scripts/setup.bat

printf '\n== Dockerfile excerpt ==\n'
nl -ba Dockerfile | sed -n '1,80p'

printf '\n== scripts/setup.bat excerpt ==\n'
nl -ba scripts/setup.bat | sed -n '1,120p'

printf '\n== Search for checksum/hash handling ==\n'
rg -n "sha256|checksum|Get-FileHash|sha512|hash" -S . || true

Repository: oTalentz/plugin-minecraft-2026

Length of output: 275


🌐 Web query:

PaperMC fill v3 downloads server:default checksums sha256 documentation

💡 Result:

PaperMC has transitioned to a new download service named Fill (formerly Bibliothek), which uses the v3 API [1]. This service is hosted at fill.papermc.io [2][1]. Unlike previous versions, you should no longer manually construct download URLs; instead, you retrieve them directly from the API responses [1][3]. Key Technical Details for Fill v3: Base URL: All requests should be made to https://fill.papermc.io [2][1]. Downloads and Checksums: In the v3 API, download information—including the SHA256 checksum and the direct download URL—is embedded directly within the build object [4][3]. The primary download key for the server JAR is server:default [2][4][1]. API Response Structure: A typical build response includes a downloads object containing the server:default entry. This entry provides the following fields [4]: name: The filename (e.g., paper-1.21.8-56.jar) [4] url: The absolute URL to the binary, hosted at fill-data.papermc.io [4][1] checksums: An object containing the sha256 hash string [2][4] size: The size of the file in bytes [4] Implementation Notes: User-Agent: It is required to provide a descriptive User-Agent header when making requests to the Fill v3 API [5][3]. GraphQL: An experimental GraphQL API is also available for more complex queries at https://fill.papermc.io/graphql [2][1]. Deprecated API: The older v1/v2 API at api.papermc.io has been sunset and should no longer be used [1][3]. For detailed interactive documentation and schema exploration, you can access the Swagger UI documentation typically provided by the service [1]. Always ensure your scripts resolve the download URL dynamically from the JSON response rather than using hardcoded paths [1][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import urllib.request, json
url = 'https://docs.papermc.io/misc/downloads-service/'
try:
    with urllib.request.urlopen(url, timeout=20) as r:
        data = r.read().decode('utf-8', 'replace')
    print('Fetched docs length:', len(data))
    for needle in ['checksums', 'sha256', 'server:default', 'downloads']:
        idx = data.lower().find(needle.lower())
        print(f'Needle {needle!r}:', idx)
        if idx != -1:
            start = max(0, idx-300)
            end = min(len(data), idx+900)
            print(data[start:end])
            print('---')
except Exception as e:
    print('ERROR', type(e).__name__, e)
PY

Repository: oTalentz/plugin-minecraft-2026

Length of output: 317


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the exact context around the two download paths and whether any digest validation exists elsewhere.
sed -n '1,120p' Dockerfile | nl -ba
printf '\n---\n'
sed -n '1,120p' scripts/setup.bat | nl -ba
printf '\n---\n'
rg -n "Invoke-FileHash|sha256sum|checksums\.sha256|server:default|fill-data" Dockerfile scripts setup* . -S || true

Repository: oTalentz/plugin-minecraft-2026

Length of output: 208


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== Dockerfile ==\n'
sed -n '1,80p' Dockerfile | cat -n

printf '\n== scripts/setup.bat ==\n'
sed -n '1,120p' scripts/setup.bat | cat -n

printf '\n== Existing digest/hash handling ==\n'
rg -n "sha256|checksum|Get-FileHash|sha512|hash" -S Dockerfile scripts . || true

Repository: oTalentz/plugin-minecraft-2026

Length of output: 7636


Verify the Paper JAR digest before using it.

  • Dockerfile#L27-L31: unzip -tqq only checks archive structure; compare the downloaded JAR against downloads."server:default".checksums.sha256 before accepting it.
  • scripts/setup.bat#L35-L36: add the same SHA-256 check before the downloaded JAR is used.
📍 Affects 2 files
  • Dockerfile#L27-L31 (this comment)
  • scripts/setup.bat#L35-L36
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 27 - 31, Verify the downloaded Paper JAR’s SHA-256
digest against downloads."server:default".checksums.sha256 before it is accepted
or used: update the Dockerfile download flow near unzip -tqq and add the
equivalent check in scripts/setup.bat near the JAR download. Preserve the
existing failure behavior and reject the artifact when the digest does not
match.

Source: MCP tools

Comment thread scripts/setup.bat
Comment on lines +35 to +36
REM A API v2 foi DESCONTINUADA (sunset). Usamos a API fill v3 para obter a URL real.
powershell -Command "$meta = Invoke-RestMethod -Uri 'https://fill.papermc.io/v3/projects/paper/versions/%PAPER_VERSION%/builds/latest'; Invoke-WebRequest -Uri $meta.downloads.'server:default'.url -OutFile '%PAPER_JAR%'"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- scripts/setup.bat ---\n'
nl -ba scripts/setup.bat | sed -n '1,120p'

printf '\n--- search for sha256 / fill / papermc in repo ---\n'
rg -n "sha256|fill\.papermc\.io|papermc\.io|Invoke-RestMethod|Invoke-WebRequest" -S .

Repository: oTalentz/plugin-minecraft-2026

Length of output: 259


🌐 Web query:

PaperMC downloads service fill v3 sha256 metadata server:default url docs origin checksum

💡 Result:

PaperMC's download service, now referred to as Fill v3, serves as the successor to the previous Bibliothek (v2) API [1][2]. All automated tools, scripts, and server hosts must migrate to the new fill.papermc.io domain, as the old api.papermc.io endpoint has been sunset [1][3][2]. Key changes and technical details for Fill v3 include: 1. API Endpoint and Domain: The primary domain is now fill.papermc.io [1][2]. The REST API and an experimental GraphQL endpoint (https://fill.papermc.io/graphql) are hosted here [4][1]. 2. Download URLs: Download links are no longer manually constructed. They are now embedded directly in the API response under the url field and point to the fill-data.papermc.io domain [1][3][2]. 3. Metadata and Keys: - The key for the standard server jar has been updated from application (used in v2) to server:default [3][2]. - Other keys include server:mojang for Mojang-mapped jars [2]. - API responses now include comprehensive metadata, including SHA256 checksums and file sizes, located within the checksums object [4][5][3]. 4. Required Headers: All requests to the Fill v3 API must include a non-generic User-Agent header (e.g., identifying the project, bot, or contact info) to avoid rate-limiting or rejection [4][6][3]. Example GraphQL query for fetching the latest stable build download URL: query LatestStableBuildDownloadURL { project(key: "paper") { key versions(first: 1, orderBy: {direction: DESC}) { edges { node { key builds(filterBy: { channel: STABLE }, first: 1, orderBy: { direction: DESC }) { edges { node { number download(key: "server:default") { name url checksums { sha256 } size } } } } } } } } } Official documentation for the service is maintained at the PaperMC Downloads Service documentation page [4].

Citations:


🌐 Web query:

site:docs.papermc.io downloads service fill v3 sha256 server:default url

💡 Result:

The term "server:default" appears as a specific key used within the PaperMC Downloads Service API [1]. It is utilized when querying for the download information of a project build (such as Paper) to specify which artifact download should be returned [1]. In the context of the PaperMC Downloads Service GraphQL API, when you request the download object for a build, you provide key: "server:default" to retrieve the primary server JAR file [1]. The response for this query includes the following fields [1]: - name: The filename of the download. - url: The direct URL to the artifact (e.g., hosted on fill-data.papermc.io) [1]. - checksums: A nested object containing the sha256 hash of the file [1]. - size: The size of the file in bytes [1]. The "v3" mentioned in your query refers to the versioning of the data API endpoints (e.g., https://fill-data.papermc.io/v3/...) used by PaperMC to serve these artifacts [1]. The "fill" in the URL path is associated with the storage or delivery service for these downloads [1]. If you are interacting with this API programmatically, you would use these fields to verify the integrity of the downloaded file using the provided SHA-256 checksum [1].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba scripts/setup.bat | sed -n '1,120p'

printf '\n--- matches ---\n'
rg -n "sha256|fill\.papermc\.io|papermc\.io|Invoke-RestMethod|Invoke-WebRequest" -S .

Repository: oTalentz/plugin-minecraft-2026

Length of output: 208


Compare the downloaded JAR to Fill’s checksums.sha256. The metadata already supplies the direct URL, but the script still accepts the file without any integrity check. A hash match before the success message would catch corrupted or substituted artifacts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/setup.bat` around lines 35 - 36, Update the PowerShell download
command in the setup script to retrieve and validate Paper’s checksums.sha256
against the downloaded file before reporting success. Use the metadata/download
URL flow around PAPER_VERSION and PAPER_JAR, ensure a hash mismatch fails the
setup, and only continue after a successful integrity check.

Source: MCP tools

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.

1 participant