Dedicated server fails to connect(400)

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
yukinyaa
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Dec 19, 2017 5:14 pm
Contact:

Dedicated server fails to connect(400)

Post by yukinyaa »

[./data/server-settings.json]

Code: Select all

{
  "name": "megabase, read description [KO/DC-ONLY]",
  "description": "비번: 디씨 대장의 이름- 1.김 2.박 3.남 4.의 5.헌 6.정 7.현 8.유 9.식, 30분 잠수 오토킥",
  "tags": [ "game", "tags" ],

  "_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.",
  "max_players": 0,

  "_comment_visibility": [
    "public: Game will be published on the official Factorio matching server",
    "lan: Game will be broadcast on LAN"
  ],
  "visibility": {
    "public": true,
    "lan": true
  },

  "_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public",
  "username": "",
  "password": "",

  "_comment_token": "Authentication token. May be used instead of 'password' above.",
  "token": "mykey",

  "game_password": "189",

  "_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account",
  "require_user_verification": true,

  "_comment_max_upload_in_kilobytes_per_second": "optional, default value is 0. 0 means unlimited.",
  "max_upload_in_kilobytes_per_second": 0,

  "_comment_minimum_latency_in_ticks": "optional one tick is 16ms in default speed, default value is 0. 0 means no minimum.",
  "minimum_latency_in_ticks": 0,

  "_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.",
  "ignore_player_limit_for_returning_players": false,

  "_comment_allow_commands": "possible values are, true, false and admins-only",
  "allow_commands": "admins-only",

  "_comment_autosave_interval": "Autosave interval in minutes",
  "autosave_interval": 30,

  "_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.",
  "autosave_slots": 5,

  "_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.",
  "afk_autokick_interval": 30,

  "_comment_auto_pause": "Whether should the server be paused when no players are present.",
  "auto_pause": true,

  "only_admins_can_pause_the_game": true,

  "_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.",
  "autosave_only_on_server": true,

  "_comment_non_blocking_saving": "Highly experimental feature, enable only at your own risk of losing your saves. On UNIX systems, server will fork itself to create an autosave. Autosaving on connected Windows clients will be disabled regardless of autosave_only_on_server option.",
  "non_blocking_saving": false,

  "_comment_admins": "List of case insensitive usernames, that will be promoted immediately",
  "admins": [ "yukinyaa" ]
}

Code: Select all

C:\Users\woong\Documents\Factorio_0.16.51>.\bin\x64\factorio.exe --start-server ./maps/pumped-up-kicks.zip --server-settings ./data/server-settings.json
   0.010 2018-12-21 20:43:01; Factorio 0.16.51 (build 36654, win64, alpha)
   0.013 Operating system: Windows 10 (version 1803)
   0.014 Program arguments: ".\bin\x64\factorio.exe" "--start-server" "./maps/pumped-up-kicks.zip" "--server-settings" "./data/server-settings.json"
   0.018 Read data path: C:/Users/woong/Documents/Factorio_0.16.51/data
   0.023 Write data path: C:/Users/woong/Documents/Factorio_0.16.51 [63789/228326MB]
   0.033 Binaries path: C:/Users/woong/Documents/Factorio_0.16.51/bin
   0.085 System info: [CPU: AMD Ryzen 5 2400G with Radeon Vega Graphics    , 4 cores, RAM: 9516/15292 MB, page: 16623/20705 MB, virtual: 4244/134217727 MB, extended virtual: 0 MB]
   0.088 Running in headless mode
   0.117 Loading mod core 0.0.0 (data.lua)
   0.193 Loading mod base 0.16.51 (data.lua)
   0.588 Loading mod base 0.16.51 (data-updates.lua)
   0.661 Checksum for core: 840319042
   0.661 Checksum of base: 3323233190
   0.810 Info PlayerData.cpp:65: Local player-data.json available, timestamp 1545392576
   0.811 Info PlayerData.cpp:72: Cloud player-data.json unavailable
   0.815 Custom inputs active: 0
   1.889 Authorization error (Username and token don't match)
   1.890 Factorio initialised
   1.891 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
   1.891 Info ServerMultiplayerManager.cpp:699: mapTick(4294967295) changing state from(Ready) to(PreparedToHostGame)
   1.891 Info ServerMultiplayerManager.cpp:699: mapTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame)
   1.892 Loading map C:\Users\woong\Documents\Factorio_0.16.51\.\maps\pumped-up-kicks.zip: 891036 bytes.
   2.045 Loading Level.dat: 1391542 bytes.
   2.052 Info Scenario.cpp:136: Map version 0.16.51-0
   2.123 Loading script.dat: 176 bytes.
   2.128 Checksum for script C:/Users/woong/Documents/Factorio_0.16.51/temp/currently-playing/control.lua: 950616531
   2.130 Info UDPSocket.cpp:27: Opening socket at (IP ADDR:({0.0.0.0:34197}))
   2.131 Hosting game at IP ADDR:({0.0.0.0:34197})
   2.131 Info HttpSharedState.cpp:54: Downloading https://auth.factorio.com/generate-server-padlock-2
   3.174 Info HttpSharedState.cpp:145: Status code: 200
   3.175 Info AuthServerConnector.cpp:109: Obtained serverPadlock for serverHash (giSy5PrKsOcwR4xnHLyhIenojoDeQkSj) from the auth server.
   3.177 Info ServerMultiplayerManager.cpp:699: mapTick(8) changing state from(CreatingGame) to(InGame)
   3.183 Info ServerRouter.cpp:596: Asking pingpong servers (pingpong1.factorio.com:34197, pingpong2.factorio.com:34197) for own address
   3.266 Info UDPSocket.cpp:39: Opening socket for broadcast
   3.586 Info ServerRouter.cpp:491: Own address is IP ADDR:({my ip:34197})
   4.538 Info HttpSharedState.cpp:143: Downloading https://multiplayer.factorio.com/create-game
   4.538 Info HttpSharedState.cpp:145: Status code: 400
  33.810 Info HttpSharedState.cpp:143: Downloading https://multiplayer.factorio.com/create-game
  33.810 Info HttpSharedState.cpp:145: Status code: 400
  63.815 Info HttpSharedState.cpp:143: Downloading https://multiplayer.factorio.com/create-game
  63.816 Info HttpSharedState.cpp:145: Status code: 400
  93.795 Info HttpSharedState.cpp:143: Downloading https://multiplayer.factorio.com/create-game
  93.796 Info HttpSharedState.cpp:145: Status code: 400
  93.808 Error ServerMultiplayerManager.cpp:633: Matching server connection failed: Error when creating server game: Download failed (status code 400): failed to parse JSON response: Unexpected character at ?:1
 123.798 Info HttpSharedState.cpp:143: Downloading https://multiplayer.factorio.com/create-game
 123.798 Info HttpSharedState.cpp:145: Status code: 400
 153.795 Info HttpSharedState.cpp:143: Downloading https://multiplayer.factorio.com/create-game
 153.796 Info HttpSharedState.cpp:145: Status code: 400
I am using DMZ setting on my router. The server is running on windows and not on moderated network. Network is really stable and fast.
The same setup was previously running and only thing changed is server name/desc.

Thanks for your attention.

yukinyaa
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Dec 19, 2017 5:14 pm
Contact:

Re: Dedicated server fails to connect(400)

Post by yukinyaa »

Tried:
- re configuring server-settings.json
- clean installing factorio (from official download)

I am running server by bat file below:
run server.bat
.\bin\x64\factorio.exe --start-server ./saves/pumped-up-kicks.zip --server-settings data/server-settings.json
pause

Zaflis
Filter Inserter
Filter Inserter
Posts: 417
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Dedicated server fails to connect(400)

Post by Zaflis »

Have you portforwarded 34197 in router?

yukinyaa
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Dec 19, 2017 5:14 pm
Contact:

Re: Dedicated server fails to connect(400)

Post by yukinyaa »

Yes, and this is keep happening when I have direct connection.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Dedicated server fails to connect(400)

Post by Rseding91 »

It almost looks like the server is adding a byte-order-marker to the JSON response.

Try this: remove the > 1 byte characters from the server settings JSON file and see if it lets you connect.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Technical Help”