gamedig / node-gamedig

Query game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
https://www.npmjs.com/package/gamedig
MIT License
607 stars 146 forks source link

bug: minecraft modded "Unexpected non-whitespace character after JSON" #419

Closed Mobuis closed 11 months ago

Mobuis commented 11 months ago

Describe the bug Hi, I'm using LinuxGSM for my modded minecraft server. When I'm trying to use gamedig, I got an error, 2 JSON objects separated by a character are trying to be parsed.

Steps To Reproduce

Expected behavior Successful result without crash error ?

Screenshots or Data

```gamedig --type minecraft 0.0.0.0:25587 --debug``` ``` Q#0 Starting Q#0 Protocol: Minecraft Q#0 Options: { socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, ipFamily: 0, port: 25587, protocol: 'minecraft', requestRules: false, type: 'minecraft', host: '0.0.0.0', debug: true } Q#0 DNS Lookup: 0.0.0.0 Q#0 Raw IP Address: 0.0.0.0 Q#1 Starting Q#1 Protocol: MinecraftVanilla Q#1 Options: { socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, ipFamily: 0, port: 25587, protocol: 'minecraft', requestRules: false, type: 'minecraft', host: '0.0.0.0', debug: true, address: '0.0.0.0' } Q#1 0.0.0.0:25587 TCP Connecting Q#2 Starting Q#2 Protocol: Gamespy3 Q#2 Options: { socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, ipFamily: 0, port: 25587, protocol: 'minecraft', requestRules: false, type: 'minecraft', host: '0.0.0.0', debug: true, address: '0.0.0.0', encoding: 'utf8' } Q#3 Starting Q#3 Protocol: MinecraftBedrock Q#3 Options: { socketTimeout: 2000, attemptTimeout: 10000, maxAttempts: 1, ipFamily: 0, port: 25587, protocol: 'minecraft', requestRules: false, type: 'minecraft', host: '0.0.0.0', debug: true, address: '0.0.0.0' } ------ Q#1 Packet ID: 0 Q#1 String Length: 164 Q#1 {"version":{"name":"1.20.1","protocol":763},"enforcesSecureChat":true,"description":{"text":"SERVER_NAME"},"players":{"max":20,"online":0},"preventsChatReports":true}Y{"releaseType":"unknown","projectId":532141,"name":"Fantasy MC Fabric","version":"1.2.0"} Q#1 Query failed with error SyntaxError: Unexpected non-whitespace character after JSON at position 164 ```

Additional context I can provide more logs if needed. Just ask :)

CosminPerRam commented 11 months ago

The response packet is a JSON String, and its a valid one until that Y character that behaves like a separator for the next JSON String, which isn't something that we have covered.

Could you also send a list of your mods (and server (Fabric, Forge etc)? It seems like one of them is altering the network response state and we could add support for it.

Mobuis commented 11 months ago

Mods :

``` 'AdditionalStructures-1.20.x-(v.4.2.1).jar' adventurez-1.4.19.jar alloy-forgery-2.0.22+1.20.jar Amplified_Nether_1.20.2_v1.2.3.jar animal_feeding_trough-1.0.3+1.20.1.jar architectury-9.1.12-fabric.jar areas-1.20.1-5.0.jar artifacts-fabric-9.1.0.jar autotag-2.0.2+1.20.jar auto_third_person-fabric-1.20.1-2.1.jar awesomedungeon-fabric-1.20.1-3.2.0.jar awesomedungeonnether-fabric-1.20.1-3.1.1.jar azurelibarmor-fabric-1.20.1-2.0.0.jar azurelib-fabric-1.20.1-2.0.6.jar balm-fabric-1.20.1-7.1.4.jar BasicNetherOres-fabric-1.20.1-9.1.1.jar bclib-3.0.13.jar besmirchment-1.20.1-2.jar betterchunkloading-fabric-1.20.1-2.3.jar bettercombat-fabric-1.8.0+1.20.1.jar BetterCompatibilityChecker-fabric-4.0.8+mc1.20.1.jar better-end-4.0.10.jar better-nether-9.0.9.jar betterstats-3.5.1+fabric-1.20.1.jar bewitchment-1.20-6.jar blossom-fabric-1.20-pre4-1.0.7.jar BOMD-1.7.2-1.20.jar Bookshelf-Fabric-1.20.1-20.1.6.jar Bountiful-6.0.3+1.20.1-fabric.jar bygonenether-1.20-1.3.2.jar cardinal-components-api-5.2.2.jar castle_dungeons-4.0.0-1.20-fabric.jar CHAS-1.20-1.10-Fabric.jar Chimes-v2.0.1-1.20.1-Fabric.jar chunksending-fabric-1.20.1-2.6.jar Chunky-1.3.92.jar cloth-config-11.1.106-fabric.jar Clumps-fabric-1.20.1-12.0.0.3.jar clutter-1.20-0.4.3.jar collective-1.20.1-7.7.jar combatroll-fabric-1.2.3+1.20.1.jar comforts-fabric-6.3.4+1.20.1.jar CorgiLib-fabric-1.20.1-4.0.0.4.jar CreativeCore_FABRIC_v2.11.7_mc1.20.1.jar cristellib-1.1.5-fabric.jar ctov-3.3.6.jar cupboard-fabric-1.20.1-2.1.jar dawn-5.0.0.jar 'Decorative Blocks-fabric-1.20.1-4.0.3.jar' deeperdarker-fabric-1.20-1.2.3.jar digs_dnd_origins-1.20.1-0.0.11.jar doapi-1.2.8-fabric.jar doubledoors-1.20.1-5.1.jar DramaticDoors-QuiFabrge-1.20.1-3.1.5.jar dummmmmmy-1.20-1.8.10-fabric.jar 'dungeons-and-taverns-3.0.3 [Fabric].jar' dungeonz-1.0.2.jar EasyMagic-v8.0.1-1.20.1-Fabric.jar eldritch-mobs-1.15.0.jar emotecraft-for-MC1.20.1-2.2.7-b.build.50-fabric.jar endermanoverhaul-fabric-1.20.1-1.0.1.jar enhancedblockentities-0.9+1.20.jar explorations-fabric-1.20.1-1.5.2.jar ExplorersCompass-1.20.1-2.2.3-fabric.jar explorify-v1.3.0-mc1.20.jar fabric-api-0.90.7+1.20.1.jar fabric-end-remastered-5.2.3.jar fabric-language-kotlin-1.10.14+kotlin.1.9.20.jar fabric-release-spawnbalanceutility-1.20-3.jar farmers-delight-fabric-mc1.20.1-1.4.2.jar ferritecore-6.0.1-fabric.jar flow-1.1.0+1.20.jar ForgeConfigAPIPort-v8.0.0-1.20.1-Fabric.jar forgottengraves-1.20.1-3.2.4.jar formations-1.0.1-fabric-mc1.20.jar formationsnether-1.0.2.jar formationsoverworld-1.0.1.jar framework-fabric-1.20.1-0.6.16.jar frostiful-0.10.1.jar ftb-library-fabric-2001.1.4.jar ftb-quests-fabric-2001.2.0.jar ftb-ranks-fabric-2001.1.3.jar ftb-teams-fabric-2001.1.4.jar Galosphere-1.20.1-1.3.1-Fabric.jar gazebo-1.1.1+1.20.1.jar geckolib-fabric-1.20.1-4.2.4.jar getittogetherdrops-fabric-1.20-1.3.1.jar goblintraders-fabric-1.20.1-1.9.3.jar GuardiansGalore-1.20.1-3.1.jar guardvillagers-2.0.8-1.20.1.jar guiclock-1.20.1-4.3.jar handcrafted-fabric-1.20.1-3.0.5.jar hybrid-aquatic-1.1.0.jar Iceberg-1.20.1-fabric-1.1.15.jar IllagerInvasion-v8.0.2-1.20.1-Fabric.jar immersive_armors-1.6.1+1.20.1-fabric.jar immersive_melodies-0.1.0+1.20.1-fabric.jar impersonate-2.10.0-standalone.jar indium-1.0.27+mc1.20.1.jar inmis-2.7.2-1.20.1.jar inmisaddon-1.0.4.jar InventorySorter-1.9.0-1.20.jar invoke-0.1.2.jar iris-mc1.20.1-1.6.10.jar item-filters-fabric-2001.1.0-build.55.jar Jade-1.20-fabric-11.6.2.jar Jewelry-1.2.0+1.20.1.jar Kambrik-6.1.1+1.20.1-fabric.jar knavesneeds-fabric-2.0.1+1.20.1.jar konkrete_fabric_1.7.0-1_MC_1.20.1.jar krypton-0.2.3.jar letmedespawn-fabric-1.20.x-1.2.0.jar letsdo-bakery-fabric-1.1.3b.jar letsdo-meadow-fabric-1.3.3.jar libIPN-fabric-1.20-4.0.1.jar libraryferret-fabric-1.20.1-4.0.0.jar libz-1.0.2.jar limitedchunks-fabric-1.20.1-3.8.jar lithium-fabric-mc1.20.1-0.11.2.jar livingthings-fabric-1.20.1-2.0.2.jar lootintegrations-fabric-1.20.1-3.2.jar lootr-1.20-0.7.29.75.jar luckperms LuckPerms-Fabric-5.4.102.jar mcda-5.0.1.jar mcdar-3.0.0.jar mcdw-8.1.0.jar memoryleakfix-fabric-1.17+-1.1.2.jar mes-1.3-1.19.4-fabric.jar midnightlib-fabric-1.4.1.jar minecells-1.5.7.jar minerally-1.20.2-1.0.jar moonlight-1.20-2.8.64-fabric.jar morechathistory-1.19.1-1.1.1.jar MutantMonsters-v8.0.4-1.20.1-Fabric.jar mvs-4.1.1-1.20-fabric.jar mysticaloaktree-1.20-1.11-fabric.jar mythicmetals-0.18.2+1.20.jar mythicmobs-1.20.1-fabric-1.4.5.jar mythic-mounts-1.20.1-7.4.jar nameplate-1.1.4.jar NaturesCompass-1.20.1-2.2.3-fabric.jar naturespirit-1.1.1-1.20.1.jar netherdepthsupgrade-fabric-3.1.1-1.20.jar NoChatReports-FABRIC-1.20.1-v2.2.2.jar NoSeeNoTick-2.0.0-1.20.1.jar 'Nyctophobia_1.9_(FABRIC)_for_1.20+.jar' nyfsspiders-fabric-1.20.1-2.1.1.jar observable-4.4.0.jar open-parties-and-claims-fabric-1.20.1-0.20.0.jar Origins-1.20.1-1.10.0.jar owo-lib-0.11.2+1.20.jar paladins-1.0.4+1.20.1.jar Paraglider-fabric-20.1.1.jar Patchouli-1.20.1-81-FABRIC.jar Paxi-1.20-Fabric-4.0.jar Pehkui-3.7.11+1.14.4-1.20.2.jar 'Philips-Ruins1.20.1-2.5[Fabric].jar' player-animation-lib-fabric-1.0.2-rc1+1.20.jar polymorph-fabric-0.49.1+1.20.1.jar Prism-1.20.1-fabric-1.0.5.jar projectile_damage-fabric-3.2.2+1.20.1.jar promenade-4.1.1.jar puffish_skills-0.10.0-1.20-fabric.jar PuzzlesLib-v8.1.5-1.20.1-Fabric.jar reds-more-structures-1.0.8-common.jar RegionsUnexploredFabric-0.5.31.20.1.jar repurposed_structures-7.1.11+1.20.1-fabric.jar resourcefulconfig-fabric-1.20.1-2.1.0.jar resourcefullib-fabric-1.20.1-2.1.13.jar RoughlyEnoughItems-12.0.672.jar rpgdifficulty-1.3.13.jar runes-fabric-0.9.10+1.20.1.jar Searchables-fabric-1.20.1-1.0.2.jar servercore-fabric-1.3.9+1.20.1.jar Shield_Overhaul-FABRIC-MC1.20.1-1.0.3.jar ShowMeWhatYouGot-1.20-1.1.1.jar simplyskills-0.25.3+1.20.1.jar simplyswords-fabric-1.51.5-1.20.1.jar SkyVillages-1.0.3.1-1.19.2-1.20.1-fabric.jar smarterfarmers-1.20-1.7.3-fabric.jar smoothchunk-fabric-1.20.1-3.2.jar Soaring-Structures-2-1.20.1-2.5.1-FABRIC.jar soulslike-weaponry-1.0.0-1.20-fabric.jar soundphysics-fabric-1.20.1-1.2.1.jar spark-1.10.53-fabric.jar Species-1.20.1-1.3-Fabric.jar spellbladenext-1.1.1.jar spell_engine-0.12.4+1.20.1.jar spell_power-fabric-0.9.18+1.20.1.jar stackrefill-1.20.1-4.1.jar starlight-1.1.2+fabric.dbc156f.jar starterkit-1.20.1-5.2.jar Structory_1.20.2_v1.3.3.jar Structory_Towers_1.20.2_v1.0.5.jar structureessentials-fabric-1.20.1-3.0.jar structure_pool_api-1.0+1.20.1.jar tectonic-mod-mc1.19.3+-v2.1.1.jar TerraBlender-fabric-1.20.1-3.0.0.169.jar Terralith_1.20.2_v2.4.8.jar 'The_Graveyard_3.0_(FABRIC)_for_1.20.1.jar' thermoo-2.1.0.jar tidal-towns-1.2.jar tiered-1.3.0.jar timecontrol-1.20.1-1.4.1.jar tlc-fabric-1.0.1-1.20.X.jar toms_storage_fabric-1.20-1.6.5.jar toofast-fabric-1.20-1.2.0.jar totw_additions-1.3.0-1.20.x-fabric.jar Towns-and-Towers-1.11.1-Fabric+Forge.jar travellerz-1.0.0.jar treeharvester-1.20.2-8.2.jar trinkets-3.7.1.jar ultris-v5.6.9b.jar vanish-1.4.2+1.20.jar villagernames-1.20.1-4.5.2.jar.disabled 'VillagersPlus_2.1_(FABRIC)_for_1.20.1.jar' villagesandpillages-fabric-mc1.20.1-1.0.0.jar VisualWorkbench-v8.0.0-1.20.1-Fabric.jar voicechat-fabric-1.20.1-2.4.28.jar voidz-1.0.10.jar Wabi-Sabi-Structures-2.0.0-1.20-Fabric.jar weaponmaster-multi-fabric-1.20.1-3.0.5.jar wits-1.1.0+1.20.1-fabric.jar wizards-1.0.4+1.20.1.jar worldedit-mod-7.2.15.jar wraith-waystones-3.3.1+mc1.20.1.jar Xaeros_Minimap_23.8.4_Fabric_1.20.jar XaerosWorldMap_1.36.0_Fabric_1.20.jar YeetusExperimentus-Fabric-2.3.1-build.6+mc1.20.1.jar yet-another-config-lib-fabric-3.2.1+1.20.jar yosbr-0.1.2.jar YungsApi-1.20-Fabric-4.0.2.jar YungsBetterDesertTemples-1.20-Fabric-3.0.3.jar YungsBetterDungeons-1.20-Fabric-4.0.3.jar YungsBetterJungleTemples-1.20-Fabric-2.0.4.jar YungsBetterMineshafts-1.20-Fabric-4.0.4.jar YungsBetterNetherFortresses-1.20-Fabric-2.0.5.jar YungsBetterOceanMonuments-1.20-Fabric-3.0.3.jar YungsBetterStrongholds-1.20-Fabric-4.0.3.jar YungsBetterWitchHuts-1.20-Fabric-3.0.3.jar YungsBridges-1.20-Fabric-4.0.3.jar ```

Running with Fabric

Do you want other information ?

CosminPerRam commented 11 months ago

Is this the Fantasy MC Fabric modpack?

Mobuis commented 11 months ago

Yes absolutely ! I've added a bunch of mods in addition.

Mobuis commented 11 months ago

Hello, do you have any news ? Do you want I test something ? Keep me updated if possible ! 😄

CosminPerRam commented 11 months ago

Hey, I didnt had the time to look deeply into this yet (work, irl stuff etc), I will have to look through what mod exactly modifies the server query response, if you could investigate a bit that would be greatly helpful.

Mobuis commented 11 months ago

hey, I've found the mod "Better Compatibility Checker" is causing the bug. I'm removing it to ensure the server's queries will work well. I'll look deeper later, but at least we have a clue.

CosminPerRam commented 11 months ago

Solved in the soon-to-be-released 4.3.0

Expand-sys commented 11 months ago

Hey, still getting this same error with version 4.3.0 and BCC mod enabled, happy to help where i can just let me know what you need

CosminPerRam commented 11 months ago

Hmmm, weird, I do have tested it multiple times. Could you do the query with --debug and post the logs here?

CosminPerRam commented 11 months ago

Or better yet, please make another issue to have this tracked properly (:

Expand-sys commented 11 months ago

new issue opened, thanks https://github.com/gamedig/node-gamedig/issues/434