> For the complete documentation index, see [llms.txt](https://docs.fivemstats.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fivemstats.net/tgiann-fivem-stats-script/common-problems.md).

# Common Problems

<details>

<summary>The panel cannot connect to the server (refused or timed out)</summary>

`sv_enableHttpServer` is missing or the port is wrong. Add `set sv_enableHttpServer true` to `server.cfg` and restart; the script prints a red line on start while it is missing. In the panel use the port of `endpoint_add_tcp`, see [Adding a Server](https://docs.fivemstats.net/panel/adding-a-server.md). If `info.json` opens but the panel still times out, your host's DDoS filter drops the request: [DDoS-Protected Hosts](https://docs.fivemstats.net/tgiann-fivem-stats-script/ports-and-firewall/ddos-protected-hosts.md).

</details>

<details>

<summary>"Unauthorized: Invalid or missing API key" or "Too many failed attempts"</summary>

The key in the panel does not match `tgiann_stats_secret_key`. Fix it in [Settings > Connection](https://docs.fivemstats.net/panel/settings.md#connection). After 10 wrong keys in a minute the server answers 429 for a minute.

</details>

<details>

<summary>The console says "add this line to server.cfg ... add_unsafe_child_process_permission"</summary>

FXServer's sandbox blocks programs started by a resource, so the media service cannot start. Add `add_unsafe_child_process_permission "tgiann-fivem-stats-script"` to `server.cfg` before `ensure tgiann-fivem-stats-script` and restart the server, see [Installation](https://docs.fivemstats.net/tgiann-fivem-stats-script/installation.md).

</details>

<details>

<summary>"no device found", "Use --allow-fs-read" or "No such export MediaGetConnection" in the console, the panel shows HTTP 500</summary>

An earlier 3.x version is installed. It kept its files in your server data folder, which FXServer's sandbox blocks. Update the script, move the old `tgiann-media` folder into the script folder and add the sandbox line to `server.cfg`, see [Updating from an Older Version](https://docs.fivemstats.net/tgiann-fivem-stats-script/updating-from-an-older-version.md).

</details>

<details>

<summary>"mysql_connection_string is empty or not readable"</summary>

The script cannot read oxmysql's connection string, so player names, jobs, money and [Database Backups](https://docs.fivemstats.net/tgiann-fivem-stats-script/database-backups.md) are off. If `server.cfg` limits who can read it with `add_convar_permission`, add `add_convar_permission tgiann-fivem-stats-script read mysql_connection_string` and restart the server. Otherwise set `mysql_connection_string` for oxmysql.

</details>

<details>

<summary>"another program answers on 127.0.0.1:6174, not the media service"</summary>

Another program or resource already uses the media port, so the script's requests reach it instead of the media service. Set a free port with `set tgiann_media_port 6175` before `ensure tgiann-fivem-stats-script`, open it in the firewall and restart the server, see [Ports and Firewall](https://docs.fivemstats.net/tgiann-fivem-stats-script/ports-and-firewall.md#changing-the-media-port).

</details>

<details>

<summary>"The media service is not running, check the server console"</summary>

The media service did not start. Look for red `[tgiann-media]` or `[media]` lines in the console. A line about `add_unsafe_child_process_permission` means the sandbox line is missing in `server.cfg`, see above. On Linux, `cannot start: spawn EACCES` or `cannot make .../ffmpeg executable` means the script could not make the files in `media/bin` executable: set their permissions to `755` in your host's file manager or SFTP client and restart the resource.

</details>

<details>

<summary>Statistics, logs and media are gone after an update</summary>

They are stored in `tgiann-media/` inside the script folder, and deleting the old folder deleted them. Put your copy of that folder back into the script folder while the server is stopped. Next time follow [Updating from an Older Version](https://docs.fivemstats.net/tgiann-fivem-stats-script/updating-from-an-older-version.md).

</details>

<details>

<summary>The Media page shows "Needs HTTPS on the game server"</summary>

The panel runs on HTTPS and browsers block plain HTTP files on it. Turn HTTPS on: [HTTPS](https://docs.fivemstats.net/tgiann-fivem-stats-script/https.md).

</details>

<details>

<summary>The console shows an "https:" error</summary>

With `auto` the certificate needs TCP port 80 open and free, and a public IP. Open the port ([Ports and Firewall](https://docs.fivemstats.net/tgiann-fivem-stats-script/ports-and-firewall.md)), add a filter for it if your host has a DDoS filter ([DDoS-Protected Hosts](https://docs.fivemstats.net/tgiann-fivem-stats-script/ports-and-firewall/ddos-protected-hosts.md)), stop programs using port 80, or switch to `custom` / `off` ([HTTPS](https://docs.fivemstats.net/tgiann-fivem-stats-script/https.md)).

</details>

<details>

<summary>Pictures do not load in my own game on a test PC at home</summary>

Behind a home router `auto` builds links with your outside IP. Use `set tgiann_media_https "off"`, see [HTTPS > Test server at home](https://docs.fivemstats.net/tgiann-fivem-stats-script/https.md#test-server-at-home).

</details>

<details>

<summary>/mediatest prints "failed, screenshot timed out"</summary>

The player's game did not send the screenshot in time. Make sure `screencapture` or `screenshot-basic` is started before this script, and that players can reach the media port ([Ports and Firewall](https://docs.fivemstats.net/tgiann-fivem-stats-script/ports-and-firewall.md)). On slow PCs raise **Screenshot timeout** in [Settings > Players and items](https://docs.fivemstats.net/panel/settings.md#players-and-items).

</details>

<details>

<summary>TakeImage returns "upload limit reached or media service is down"</summary>

The player started more screenshots than **Player screenshots** allows per minute, or it is `0`. See [Settings > Players and items](https://docs.fivemstats.net/panel/settings.md#players-and-items).

</details>

<details>

<summary>Backup download fails</summary>

The file comes from the media port, which must be open to the internet: [Ports and Firewall](https://docs.fivemstats.net/tgiann-fivem-stats-script/ports-and-firewall.md). The link works for 10 minutes; click download again for a new one.

</details>

<details>

<summary>My script's debug logs do not show</summary>

**Lowest level kept** is `info` by default and drops `debug` lines. Lower it in [Settings > Logs](https://docs.fivemstats.net/panel/settings.md#logs).

</details>

<details>

<summary>Items I do not care about fill the Items page</summary>

Add them to **Ignored items** in [Settings > Players and items](https://docs.fivemstats.net/panel/settings.md#players-and-items). The list updates on the next hourly scan.

</details>

<details>

<summary>Old statistics are missing after the update</summary>

The old tables are imported in parts on the first start; watch for `stats: imported <n> rows from <table>` lines. An import that stopped continues on the next start. See [Updating from an Older Version](https://docs.fivemstats.net/tgiann-fivem-stats-script/updating-from-an-older-version.md).

</details>
