itzg / docker-minecraft-server

Docker image that provides a Minecraft Server that will automatically download selected version at startup
https://docker-minecraft-server.readthedocs.io/
Apache License 2.0
8.87k stars 1.49k forks source link

ERROR : 'install-curseforge' command failed #2056

Closed omerhodzic123 closed 1 year ago

omerhodzic123 commented 1 year ago

Describe the problem

When trying to set up a Mechanical Mastery server I get a 'install-curseforge' command failed error. Logs below.

Container definition

Empty fields redacted.

mm:
    container_name: mm
    image: itzg/minecraft-server
    ports:
      - 25566:25565
    environment:
      DEBUG: "true"
      EULA: "TRUE"
      MOTD: "Mastery the Mechanical!"
      DIFFICULTY: normal
      WHITELIST: 
      ENFORCE_WHITELIST: "true"
      OPS: 
      ICON: 
      ENABLE_RCON: "true"
      RCON_PORT: 25576
      RCON_PASSWORD: qweasdzxc
      GENERATE_STRUCTURES: "true"
      SPAWN_PROTECTION: 0
      ALLOW_FLIGHT: "true"
      MEMORY: 8G
      TZ: Australia/Sydney
      OVERRIDE_SERVER_PROPERTIES: "true"
      OVERRIDE_WHITELIST: "true"
      ONLINE_MODE: "true"
      ENABLE_WHITELIST: "true"
      TYPE: AUTO_CURSEFORGE
      CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/mechanical-mastery
      CF_API_KEY: 
      #CF_SERVER_MOD: Divine_Journey_2.19.2_Server_Pack.zip
      VERSION: 1.18.2
      #USE_MODPACK_START_SCRIPT: "false"
    tty: true
    stdin_open: true
    restart: unless-stopped
    volumes:
      - /minecraft/mm:/data

Container logs

[init] 2023-04-01 15:23:03+11:00 ERROR failed to auto-install CurseForge modpack
+ exit 1
+ export HOME=/data
+ HOME=/data
++ id -u
++ id -g
++ ls -lnd /data
+ log 'Running as uid=1000 gid=1000 with /data as '\''drwxrwxr-x 2 1000 1000 4096 Apr  1 14:34 /data'\'''
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
[init] 2023-04-01 15:23:04+11:00 Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 2 1000 1000 4096 Apr  1 14:34 /data'
+ '[' '!' -e /data/eula.txt ']'
+ isTrue false
+ case "${1,,}" in
+ return 1
+ isTrue false
+ case "${1,,}" in
+ return 1
+ [[ -n '' ]]
+ [[ -n '' ]]
+ fixJavaPath
+ which java
+ export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
+ VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
+ case "X$VERSION" in
+ VANILLA_VERSION=1.18.2
+ export VANILLA_VERSION
++ get_major_version 1.18.2
++ version=1.18.2
++ echo 1.18.2
++ cut -d. -f 1-2
+ MAJOR_VANILLA_VERSION=1.18
+ export MAJOR_VANILLA_VERSION
+ log 'Resolved version given 1.18.2 into 1.18.2 and major version 1.18'
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
[init] 2023-04-01 15:23:04+11:00 Resolved version given 1.18.2 into 1.18.2 and major version 1.18
+ cd /data
+ export ORIGINAL_TYPE=AUTO_CURSEFORGE
+ ORIGINAL_TYPE=AUTO_CURSEFORGE
+ isTrue false
+ case "${1,,}" in
+ return 1
+ isTrue false
+ case "${1,,}" in
+ return 1
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ versionLessThan 1.7
+ mc-image-helper compare-versions 1.18.2 lt 1.7
+ return 1
+ log 'Resolving type given AUTO_CURSEFORGE'
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
[init] 2023-04-01 15:23:04+11:00 Resolving type given AUTO_CURSEFORGE
+ case "${TYPE^^}" in
+ exec /start-deployAutoCF
+ args=(--results-file="$resultsFile")
+ [[ -n https://www.curseforge.com/minecraft/modpacks/mechanical-mastery/files/4238671 ]]
+ args+=(--modpack-page-url="$CF_PAGE_URL")
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ args+=(--parallel-downloads="$CF_PARALLEL_DOWNLOADS" --force-synchronize="$CF_FORCE_SYNCHRONIZE")
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n https://raw.githubusercontent.com/itzg/docker-minecraft-server/master/files/cf-exclude-include.json ]]
+ args+=(--exclude-include-file="$CF_EXCLUDE_INCLUDE_FILE")
+ mc-image-helper install-curseforge --results-file=/data/.install-curseforge.env --modpack-page-url=https://www.curseforge.com/minecraft/modpacks/mechanical-mastery/files/4238671 --parallel-downloads=4 --force-synchronize=false --exclude-include-file=https://raw.githubusercontent.com/itzg/docker-minecraft-server/master/files/cf-exclude-include.json
[mc-image-helper] 15:23:05.694 DEBUG : JSON FETCH: uri=https://raw.githubusercontent.com/itzg/docker-minecraft-server/master/files/cf-exclude-include.json headers=DefaultHttpHeaders[user-agent: mc-image-helper/1.24.12 (cmd=unspecified), accept: application/json, host: raw.githubusercontent.com]
[mc-image-helper] 15:23:05.782 DEBUG : JSON FETCH: uri=https://api.curse.tools/v1/cf/mods/search?gameId=432&slug=mechanical-mastery headers=DefaultHttpHeaders[user-agent: mc-image-helper/1.24.12 (cmd=install-curseforge), accept: application/json, host: api.curse.tools]
[mc-image-helper] 15:23:06.120 ERROR : 'install-curseforge' command failed. Version is 1.24.12
me.itzg.helpers.errors.GenericException: Failed to parse response body into class me.itzg.helpers.curseforge.model.ModsSearchResponse: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (reactor.netty.ByteBufMono$ReleasingInputStream); line: 1, column: 2]
        at me.itzg.helpers.http.ObjectFetchBuilder.lambda$assemble$1(ObjectFetchBuilder.java:59)
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:132)
        at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:181)
        at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
        at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
        Suppressed: java.lang.Exception: #block terminated with an error
                at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:99)
                at reactor.core.publisher.Mono.block(Mono.java:1710)
                at me.itzg.helpers.http.ObjectFetchBuilder.execute(ObjectFetchBuilder.java:37)
                at me.itzg.helpers.curseforge.CurseForgeInstaller.install(CurseForgeInstaller.java:89)
                at me.itzg.helpers.curseforge.InstallCurseForgeCommand.call(InstallCurseForgeCommand.java:122)
                at me.itzg.helpers.curseforge.InstallCurseForgeCommand.call(InstallCurseForgeCommand.java:20)
                at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
                at picocli.CommandLine.access$1500(CommandLine.java:148)
                at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
                at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
                at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
                at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
                at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
                at picocli.CommandLine.execute(CommandLine.java:2170)
                at me.itzg.helpers.McImageHelper.main(McImageHelper.java:104)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (reactor.netty.ByteBufMono$ReleasingInputStream); line: 1, column: 2]
        at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2418)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:749)
        at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:673)
        at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2784)
        at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:907)
        at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:793)
        at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4817)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4723)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3714)
        at me.itzg.helpers.http.ObjectFetchBuilder.lambda$assemble$1(ObjectFetchBuilder.java:57)
        ... 9 common frames omitted
+ log 'ERROR failed to auto-install CurseForge modpack'
+ local oldState
++ shopt -po xtrace
+ oldState='set -o xtrace'
+ shopt -u -o xtrace
[init] 2023-04-01 15:23:06+11:00 ERROR failed to auto-install CurseForge modpack
+ exit 1
itzg commented 1 year ago

You'll need to fill in CF_API_KEY, but I also need to add better error handling for that.

omerhodzic123 commented 1 year ago

You'll need to fill in CF_API_KEY, but I also need to add better error handling for that.

I actually did have it filled in, just removed it here because wasn't sure if it should be private. I did also make sure to include the extra $ before each of its occurrences

itzg commented 1 year ago

Ah ok, I'll research it some more then.

itzg commented 1 year ago

I just noticed, your image is old. Please re-pull that and try with that.

itzg commented 1 year ago

FYI, some modpacks/mods will require manual retrieval. Got this response from CurseForge/Overwolf:

image

I'm going to try to work on an alternate means of bootstrapping the AUTO_CURSEFORGE inputs, but might be slow going since I have personal matters this week.

jamstruth commented 1 year ago

FYI, some modpacks/mods will require manual retrieval. Got this response from CurseForge/Overwolf:

image

I'm going to try to work on an alternate means of bootstrapping the AUTO_CURSEFORGE inputs, but might be slow going since I have personal matters this week.

Could you clarify what you mean by Manual Retrieval? I tried running the pack I have been running fine (VaultHunters) via Curseforge and via Generic Packs. Curseforge failed to boot due to missing startup scripts and Generic Packs booted but had massive performance issues.

itzg commented 1 year ago

Could you clarify what you mean by Manual Retrieval? I tried running the pack I have been running fine (VaultHunters) via Curseforge and via Generic Packs

Using generic packs mechanism is what I meant.

Generic Packs booted but had massive performance issues.

Performance issues are not caused by containerization or these install mechanisms. You'll need to investigate system performance or alternate hardware.

jamstruth commented 1 year ago

Could you clarify what you mean by Manual Retrieval? I tried running the pack I have been running fine (VaultHunters) via Curseforge and via Generic Packs

Using generic packs mechanism is what I meant.

Generic Packs booted but had massive performance issues.

Performance issues are not caused by containerization or these install mechanisms. You'll need to investigate system performance or alternate hardware.

So there should be no difference between a Forge + generic pack vs AUTO_CURSEFORGE? That's not what I was seeing, at least with the pack I was using. I was using Forge 1.18.2 with GENERIC_PACK set to the server files for the pack I was wanting to run and the resulting server crashed near instantly as soon as I logged in. I may be able to grab logs if its useful.

I eventually managed to get AUTO_CURSEFORGE working and the server is once again running fine.

IceDragnon2061 commented 1 year ago

I escaped everything like you in the docu and i get every time:

2023-04-03 12:27:30 [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 2 1000 1000 4096 Apr 2 23:28 /data' 2023-04-03 12:27:31 [init] Resolved version given LATEST into 1.19.4 and major version 1.19 2023-04-03 12:27:31 [init] Resolving type given AUTO_CURSEFORGE 2023-04-03 12:27:35 [mc-image-helper] 10:27:35.283 ERROR : Invalid parameter provided for 'install-curseforge' command: Access to https://api.curseforge.com/v1 is forbidden. Make sure to set CF_API_KEY to a valid API key from https://console.curseforge.com/ 2023-04-03 12:27:35 [init] ERROR failed to auto-install CurseForge modpack

i try to set up a Docker container with Minecraft Sigma on Windows. (I know not the smartest way but normalay it works) can you maby help why it came Everytime?

IceDragnon2061 commented 1 year ago

I escaped everything like you in the docu and i get every time:

2023-04-03 12:27:30 [init] Running as uid=1000 gid=1000 with /data as 'drwxrwxr-x 2 1000 1000 4096 Apr 2 23:28 /data' 2023-04-03 12:27:31 [init] Resolved version given LATEST into 1.19.4 and major version 1.19 2023-04-03 12:27:31 [init] Resolving type given AUTO_CURSEFORGE 2023-04-03 12:27:35 [mc-image-helper] 10:27:35.283 ERROR : Invalid parameter provided for 'install-curseforge' command: Access to https://api.curseforge.com/v1 is forbidden. Make sure to set CF_API_KEY to a valid API key from https://console.curseforge.com/ 2023-04-03 12:27:35 [init] ERROR failed to auto-install CurseForge modpack

i try to set up a Docker container with Minecraft Sigma on Windows. (I know not the smartest way but normalay it works) can you maby help why it came Everytime?

I also nkwo thast is stupis what i do but this ist the comand what i copy in PowerShelel:

docker run -it -d -v Minecraft_Sigma:/data --name Sigma -p 25566:25565 -e MEMORY=8G -e EULA=TRUE -e TYPE=CURSEFORGE -e TYPE=AUTO_CURSEFORGE -e "CF_API_KEY=\$2a\$10\$..." -e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/sigma itzg/minecraft-server:java8-multiarch

IceDragnon2061 commented 1 year ago

thx for editing. Do you have a solution?

itzg commented 1 year ago

@IceDragnon2061 try using single quotes instead of double quotes. That way the shell for sure won't interpret the $'s

IceDragnon2061 commented 1 year ago

Still have that problem:

[mc-image-helper] 14:03:00.177 ERROR : Invalid parameter provided for 'install-curseforge' command: Access to https://api.curseforge.com/v1 is forbidden. Make sure to set CF_API_KEY to a valid API key from https://console.curseforge.com/

IceDragnon2061 commented 1 year ago

ok i have found out. The comand must look like this than it works:

docker run -it -d -v Minecraft_Sigma:/data --name Sigma -p 25566:25565 -e MEMORY=8G -e EULA=TRUE -e TYPE=CURSEFORGE -e TYPE=AUTO_CURSEFORGE -e CF_API_KEY='$2a$10$uOrmaL...' -e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/create-above-and-beyond itzg/minecraft-server:java8-multiarch

itzg commented 1 year ago

Thanks for the update @IceDragnon2061 . I need to fix the docs since I didn't notice before that the quotes were misplaced.

R15B commented 1 year ago

Please bear in mind that the double quotes are a requirement if done via a docker-compose.yml

i.e. CF_API_KEY: "" works and CF_API_KEY: '' does not

Just tested it as was having a similar issue, single quotes will not work in the via docker compose

itzg commented 1 year ago

@R15B FWIW I just now tested with

version: "3.8"

services:
  mc:
    image: itzg/minecraft-server
    environment:
      CF_API_KEY: '$$2a$$10$$R...'

and the following

docker compose run --entrypoint env mc

includes:

CF_API_KEY=$2a$10$R...

So, it appears single or double quotes make no difference either way. $'s need to be doubled up to escape them.

itzg commented 1 year ago

Back to the OP, I am not able to recreate the original problem with the latest image. @omerhodzic123 can you confirm if this issue can be closed?

omerhodzic123 commented 1 year ago

Back to the OP, I am not able to recreate the original problem with the latest image. @omerhodzic123 can you confirm if this issue can be closed?

Just tested it. Working with the latest image. Apologies for not thinking to check this earlier.

R15B commented 1 year ago

@R15B FWIW I just now tested with

version: "3.8"

services:
  mc:
    image: itzg/minecraft-server
    environment:
      CF_API_KEY: '$$2a$$10$$R...'

and the following

docker compose run --entrypoint env mc

includes:

CF_API_KEY=$2a$10$R...

So, it appears single or double quotes make no difference either way. $'s need to be doubled up to escape them.

Sorry to bounce back to this, I've not had to double up the $ signs in my docker compose file. I used single quotes initially and could not get the server to start.

I have it running without issue with the compose file configuration as below.

  CF_PAGE_URL: "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8"
  CF_SLUG: "all-the-mods-8"
  CF_FILE_ID: "4461163"
  CF_API_KEY: "$2a$10$8KtpCVtni5dsxzuJEgXgi.."

When I attempted this with single quotes it continued to fail with similar errors as to described in this thread.

I'll do some further testing later today and see what I find.

itzg commented 1 year ago

That's strange then since interpolation occurs either way

https://docs.docker.com/compose/compose-file/12-interpolation/

...but go with whatever works.

Edit: the $ parts of your key start with a number so it's not getting interpreted as variables. The single quote behavior is odd still. 🤷‍♂️

GsorinDev commented 10 months ago

for information the CF_API_KEY not detect the third char "$" in the key to avoid that i just add an other "$" at this position and it's work

jasenmichael commented 2 months ago

In my CF_API_KEY, I replaced all "$" with "$$", and all works now.

docker-compose.yml

services:
  mc:
    image: itzg/minecraft-server
    tty: true
    stdin_open: true
    ports:
      - "25565:25565"
    environment:
      TYPE: "AUTO_CURSEFORGE"
      # CF_SLUG: "all-the-mods-8"
      CF_PAGE_URL: "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8"
      VERSION: "1.20.1"
      # https://console.curseforge.com/#/api-keys
      # CF_API_KEY: "$abcdefg$123.456"
      CF_API_KEY: "$$abcdefg$$123.456"
      EULA: "TRUE"
    volumes:
      - ./data:/data

docker compose up