> For the complete documentation index, see [llms.txt](https://tk-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tk-scripts.gitbook.io/docs/common-problems.md).

# Common problems

Fixes for errors any TK Scripts resource can show on a FiveM server: escrow, entitlement, broken files, framework, ox\_lib, SQL and items.

## Failed to verify protected resource

When the script starts, the server console prints, with the script's name:

```
Failed to verify protected resource tk_mdt
```

The hidden `.fxap` file in the script folder is missing or damaged; some FTP programs skip it.

* Download the script again from the Cfx.re Portal and upload the whole folder, `.fxap` included.

## You lack the required entitlement to use

When the script starts, the server console prints, with the script's name:

```
You lack the required entitlement to use tk_mdt
```

The server's license key belongs to a different Cfx.re account than the one that bought the script.

* Set `sv_licenseKey` in `server.cfg` to a key from the account that bought the script.
* Or transfer the script to the key's account in the Cfx.re Portal. Cfx.re allows one transfer within 28 days, and it can't be undone.

## Syntax error near '<\1>' or ERROR: attempt to call a nil value (field 'x')

When the script starts, the server or F8 console prints one of these:

```
syntax error near '<\1>'
attempt to call a nil value (field 'x')
```

The script's files are from mixed versions, damaged or missing, or `Config.Framework` names a framework the server does not run. FiveM Enhanced did not get Asset Escrow at its early access ([Cfx.re announcement](https://forum.cfx.re/t/development-update-2-fivem-for-gtav-enhanced/5412576)), so protected scripts do not run there; use a Legacy server.

1. Check that `Config.Framework` in the script's config matches your framework.
2. Delete the script folder on the server and upload a fresh copy from the Cfx.re Portal download, `.fxap` included. If FileZilla uploaded the old copy, use WinSCP.
3. Copy your config values into the fresh config.
4. Clear the server cache and your FiveM client cache.

## No such export GetCoreObject or getSharedObject

When the script starts, the server console prints one of the first two lines, followed by the third:

```
No such export getSharedObject in resource es_extended
No such export GetCoreObject in resource qb-core
attempt to call a nil value (global 'RegisterCallback')
```

The script's framework files call a framework your server does not run, or one that starts after the script. A typical case is `Config.Framework = 'esx'` on a QBCore or Qbox server.

* Set `Config.Framework` to `'esx'` for ESX, and to `'qb'` for QBCore and Qbox.
* In `server.cfg`, `ensure` `es_extended`, `qb-core` or `qbx_core` before the script.
* On Qbox, use the current `qbx_core`. It provides the `qb-core` exports; an edited or old copy without them prints the second line.

## No such export in resource ox\_lib or ox\_inventory

When the script runs, the console prints a line like one of these:

```
No such export hasLoaded in resource ox_lib
No such export Items in resource ox_inventory
```

The resource named in the line starts after the script, or its version is too old to have the export.

* `ensure` the resource before the script in `server.cfg`.
* Update it to its latest release.
* Without ox\_inventory: set `Config.Inventory` to the inventory you run.

## ERROR: Attempt to index a nil value (global ‘lib’)

When the script runs, the F8 or server console prints:

```
attempt to index a nil value (global 'lib')
```

The script calls `lib`, but ox\_lib is not loaded in it. It calls `lib` when `Config.UseOxLib` is `true` or `Config.NotificationType` is `'ox'`.

* With ox\_lib: in `fxmanifest.lua`, remove the `--` in front of this line in `shared_scripts`, and `ensure ox_lib` before the script in `server.cfg`.

  ```lua
  '@ox_lib/init.lua',
  ```
* Without ox\_lib: set `Config.UseOxLib = false`, and set `Config.NotificationType` to another value from its list in `config.lua`.

## Warning: could not find shared\_script ox\_lib/init.lua

When the script starts, the server console prints, with your line number:

```
Warning: could not find shared_script `ox_lib/init.lua` (defined in fxmanifest.lua:22)
```

The line in `fxmanifest.lua` has lost its `@`, or ox\_lib is not installed.

* Write the line as `'@ox_lib/init.lua',`.
* Install ox\_lib and `ensure ox_lib` before the script.

## Resource manifest or web files not found

When the script starts, the server console prints one of these:

```
Warning: tk_policejob does not have a resource manifest (fxmanifest.lua)
Warning: could not find file `web/build/index.html` (defined in fxmanifest.lua:15)
```

The upload is incomplete or damaged, or the files sit one folder too deep.

1. Delete the script folder on the server.
2. Upload a fresh copy from the Cfx.re Portal download, with `fxmanifest.lua` directly inside the folder named after the script. If FileZilla uploaded the old copy, use WinSCP.

## ERROR: Unknown column 'x' in 'field list'

When the script reads the database, the server console prints, with a column name in place of `x`:

```
Unknown column 'x' in 'field list'
```

The script's database tables are missing or out of date.

* Import the `.sql` file from the script folder into the database named in your `server.cfg` connection string.
* Some files hold two blocks, `-- ESX:` for the `users` table and `-- QB:` for `players`. Run only the block for your framework.

## Table doesn't exist

When the script reads the database, the server console prints, with your database and table:

```
Table 'DATABASE.tk_drugs_labs' doesn't exist
```

The `.sql` file was not imported, or it went into a different database than the one in your `server.cfg` connection string.

* Import the `.sql` file from the script folder into the database named in your connection string, as in [the unknown column fix](#error-unknown-column-x-in-field-list).

## Failed to load model or asset

When a model is needed, the F8 or server console prints one of these:

```
Failed to load model "MODEL_HASH"
[WARNING] Failed to load asset "MODEL_HASH"
```

The model is newer than your server's game build, or the resource that streams it is not started.

* [Force a newer game build](https://forum.cfx.re/t/tutorial-forcing-gamebuilds-on-fivem/4784977) with `sv_enforceGameBuild` in `server.cfg`.
* Or change the model name in the script's config to one your build has.
* Or `ensure` the resource that streams the model before the script.

## Changing currency symbol

The symbol is part of the texts in `locales/en.lua`, or the locale file `Config.Locale` points to. Change it there, for example `'%s€'` to `'$%s'`.

In `esx_tk_mechanicjob`, prices are formatted in `html/script.js`. Replace every

```js
Intl.NumberFormat('fi-FI', { style: 'currency', currency: 'EUR' })
```

with

```js
Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' })
```

Any locale code and currency code from [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) work.

## Addon vehicle name showing as NULL

The addon vehicle has no text entry for its name.

* Add an `AddTextEntry` line per addon vehicle in any client script. The first value is the `gameName` from the vehicle's `vehicles.meta`:

  ```lua
  AddTextEntry('gtr', 'Skyline GTR 17')
  ```

## Items are not found or do nothing

Items are missing from shops and storages, or using one does nothing.

`Config.Inventory` or `Config.Framework` does not match what the server runs, or the items are not added to your inventory.

* Set `Config.Inventory` to your inventory, `'ox'` for ox\_inventory. The values each script accepts are listed beside the option in `config.lua`.
* Add the script's items to your inventory as its Installation page shows.
* On QBCore with ox\_inventory, also apply the fix below.

## Items not working on qb-core & ox\_inventory

Usable items do nothing on QBCore with an ox\_inventory version that has a `modules/bridge/qb` folder. Newer qb-core stores a usable item as a table with a `func` field, and that bridge calls the table as a function.

* In `ox_inventory/modules/bridge/qb/server.lua`, replace `server.UseItem` with:

  ```lua
  function server.UseItem(source, itemName, data)
      local cb = QBCore.Functions.CanUseItem(itemName)
      if type(cb) == 'table' and cb.func then cb = cb.func end
      return cb and cb(source, data)
  end
  ```

## 3rd party integrations not working correctly

An integration with a phone, dispatch, housing or other script breaks when that script changes its exports or events.

* Update the call in the script's editable files to match the other script's current docs.
* If you cannot find the call, open a Discord ticket with the other script's name and version.
