• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Reading console errors

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,323
Solutions
26
Reaction score
2,690
Location
Poland
For some reason a lot of people have trouble reading console errors and it makes me feel as if ability to read console errors was some ancient wisdom.

In this tutorial you will learn to understand errors in your scripts.

case 1: server closes and you can't read the error message:
If you're on Windows and console window closes the moment you start the server:
then shift + right click inside the server folder and choose "open command prompt here" (pl: "otwórz okno polecenia tutaj", not sure what it's called in br and swe localizations). Make sure nothing is selected or the option will not appear. Alternatively you can run "cmd" and navigate to engine folder using "cd" command.

If you type "theforgottenserver.exe", you will see console output without the window itself closing.
Example errors:
Code:
>> Loading config
>> Establishing database connection...
MySQL Error Message: Can't connect to MySQL server on '127.0.0.1' (10061)
> ERROR: Failed to connect to database.
>> No services running. The server is NOT online.

F:\Program Files (x86)\ot\__tfs_1_3\forgottenserver>

As you can see, the server can't connect to the database because database is not online.

Code:
[Error - BaseEvents::loadFromXml] Failed to load data/actions/actions.xml: File
was not found
> ERROR: Unable to load actions!
> ERROR: Failed to load script systems
>> No services running. The server is NOT online.

F:\Program Files (x86)\ot\__tfs_1_3\forgottenserver>

Here you can see that actions.xml was not loaded. The error structure tells us:
  • error happened during loading xml files
  • which file the server tried to load
  • what happened (in this case file was not found which may hint a missing data folder)

case 2: "call stack overflow"

This error means that there is an infinite loop somewhere in your server.
Newest tfs will just throw a warning. Older can crash.

Example of error reasons:
1. a teleport loop in your map (tp1 leading to tp2 but tp2 instantly teleporting back to tp1)
2. a recursive script that never stops, eg:
Code:
function f(param) return f(param) end f(1)
sometimes another reason, but it's mainly about infinite loops in your server

case 3: the script doesn't load
some examples of console errors:
Code:
[Warning - Event::checkScript] Can not load script: scripts/test.lua
data/talkactions/scripts/test.lua:489: '=' expected near 'n'
here we can see that the script failed to load because it had some syntax error
489 is the line in which the error might be

case 4: the script loaded but it doesn't work
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/test.lua:onUse
data/actions/scripts/test.lua:327: attempt to index local 'bridge' (a nil value)
stack traceback:
        [C]: in function '__newindex'
        data/actions/scripts/test.lua:327: in function 'createBridge'
        data/actions/scripts/test.lua:475: in function <data/actions/scripts/test.lua:457>

This error looks more complex. As you can see it has many lines. Generally, the first line of error always starts with some instance of [ ] brackets. Let's interpret it.
this is where it happens:
Code:
Lua Script Error: [Action Interface]

this is what event caused it and from which file:
Code:
data/actions/scripts/test.lua:onUse

this is what the problem is:
Code:
data/actions/scripts/test.lua:327: attempt to index local 'bridge' (a nil value)

In this case, in line 327 there was variable "bridge" expected, but it wasn't declared. This happens when your script passes wrong variable to the function or doesn't pass it at all because it's misspelled.

the rest of error is stack traceback. It helps to figure out how the function was called. We can see path to script and lines in which the functions are. In this case the mistake is in line 327 inside createBridge function. The call was made from line 475.
Code:
stack traceback:
        [C]: in function '__newindex'
        data/actions/scripts/test.lua:327: in function 'createBridge'
        data/actions/scripts/test.lua:475: in function <data/actions/scripts/test.lua:457>

Remember that pasting the full error message in support board helps locating a problem with your server faster.

If you have a problem understanding a console error, feel free to paste it here for educational purposes and someone will reply with what does it mean.
Note: this isn't a thread to fix your scripts. It's a thread about learning what do console errors mean. If you look for help with your script, make a thread in the support board.
Note2: don't ask me for help in private. You have support board that will answer faster.
 
this thread should be pinned in support board so all the people that complains about "console closing fast" will have a proper guidance
 
Im trying to fix the same problem. this is the error i get

MySQL Error Message: Plugin caching_sha2_password could not be loaded: The specified module could not be found. Library path is 'caching_sha2_password.dll'

Could anybody assist?
 
Im trying to fix the same problem. this is the error i get

MySQL Error Message: Plugin caching_sha2_password could not be loaded: The specified module could not be found. Library path is 'caching_sha2_password.dll'

Could anybody assist?
enable that in your www software its a plugin
 
For some reason a lot of people have trouble reading console errors and it makes me feel as if ability to read console errors was some ancient wisdom.

In this tutorial you will learn to understand errors in your scripts.

case 1: server closes and you can't read the error message:
If you're on Windows and console window closes the moment you start the server:
then shift + right click inside the server folder and choose "open command prompt here" (pl: "otwórz okno polecenia tutaj", not sure what it's called in br and swe localizations). Make sure nothing is selected or the option will not appear. Alternatively you can run "cmd" and navigate to engine folder using "cd" command.

If you type "theforgottenserver.exe", you will see console output without the window itself closing.
Example errors:
Code:
>> Loading config
>> Establishing database connection...
MySQL Error Message: Can't connect to MySQL server on '127.0.0.1' (10061)
> ERROR: Failed to connect to database.
>> No services running. The server is NOT online.

F:\Program Files (x86)\ot\__tfs_1_3\forgottenserver>

As you can see, the server can't connect to the database because database is not online.

Code:
[Error - BaseEvents::loadFromXml] Failed to load data/actions/actions.xml: File
was not found
> ERROR: Unable to load actions!
> ERROR: Failed to load script systems
>> No services running. The server is NOT online.

F:\Program Files (x86)\ot\__tfs_1_3\forgottenserver>

Here you can see that actions.xml was not loaded. The error structure tells us:
  • error happened during loading xml files
  • which file the server tried to load
  • what happened (in this case file was not found which may hint a missing data folder)

case 2: "call stack overflow"

This error means that there is an infinite loop somewhere in your server.
Newest tfs will just throw a warning. Older can crash.

Example of error reasons:
1. a teleport loop in your map (tp1 leading to tp2 but tp2 instantly teleporting back to tp1)
2. a recursive script that never stops, eg:
Code:
function f(param) return f(param) end f(1)
sometimes another reason, but it's mainly about infinite loops in your server

case 3: the script doesn't load
some examples of console errors:
Code:
[Warning - Event::checkScript] Can not load script: scripts/test.lua
data/talkactions/scripts/test.lua:489: '=' expected near 'n'
here we can see that the script failed to load because it had some syntax error
489 is the line in which the error might be

case 4: the script loaded but it doesn't work
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/test.lua:onUse
data/actions/scripts/test.lua:327: attempt to index local 'bridge' (a nil value)
stack traceback:
        [C]: in function '__newindex'
        data/actions/scripts/test.lua:327: in function 'createBridge'
        data/actions/scripts/test.lua:475: in function <data/actions/scripts/test.lua:457>

This error looks more complex. As you can see it has many lines. Generally, the first line of error always starts with some instance of [ ] brackets. Let's interpret it.
this is where it happens:
Code:
Lua Script Error: [Action Interface]

this is what event caused it and from which file:
Code:
data/actions/scripts/test.lua:onUse

this is what the problem is:
Code:
data/actions/scripts/test.lua:327: attempt to index local 'bridge' (a nil value)

In this case, in line 327 there was variable "bridge" expected, but it wasn't declared. This happens when your script passes wrong variable to the function or doesn't pass it at all because it's misspelled.

the rest of error is stack traceback. It helps to figure out how the function was called. We can see path to script and lines in which the functions are. In this case the mistake is in line 327 inside createBridge function. The call was made from line 475.
Code:
stack traceback:
        [C]: in function '__newindex'
        data/actions/scripts/test.lua:327: in function 'createBridge'
        data/actions/scripts/test.lua:475: in function <data/actions/scripts/test.lua:457>

Remember that pasting the full error message in support board helps locating a problem with your server faster.

If you have a problem understanding a console error, feel free to paste it here for educational purposes and someone will reply with what does it mean.
Note: this isn't a thread to fix your scripts. It's a thread about learning what do console errors mean. If you look for help with your script, make a thread in the support board.
Note2: don't ask me for help in private. You have support board that will answer faster.
Bez tytułu.pngand nothing hapend
 
why arent you clicking the .exe but instead try to run it without elevation in a command window?
 

Similar threads

Back
Top