# Troubleshooting

## ❓ Troubleshooting

### Common Issues

#### Framework not loaded

**Error:** `HATA: Framework yüklenemedi!`

**Solution:** Make sure your framework starts before elenacraft in `server.cfg`:

```cfg
ensure qb-core          # FIRST
ensure elenacraft        # AFTER
```

#### Unknown column error

**Error:** `Unknown column 'total_crafts' in 'field list'`

**Solution:** Restart the server. Auto migration will add the missing columns automatically.

***

#### ox\_lib not found

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

**Solution:** Either install ox\_lib or change notification system:

```
Config.Notify = 'qb'    -- Instead of 'ox_lib'
```

The script has automatic fallback, but explicit config is recommended.

#### Items not found / not giving

**Solution:** Make sure `Config.Inventory` matches your inventory system:

```
Config.Inventory = 'ox'   -- Must match your actual inventory
```

And all items must be registered in your inventory system.

#### Weapon bench not opening

**Cause:** The weapon bench has job and item restrictions by default.

**Solution:** Either:

1. Give the player the required job and item:

   ```
   /setjob [id] weapondealer 0
   /giveitem [id] toolkit 1
   ```
2. Or remove restrictions in `config/tables.lua`:

   ```
   job      = nil,
   needItem = nil,
   ```

#### No recipes showing

**Cause:** Table `type` doesn't match recipe `category`.

**Solution:** Check that your table's `type` matches the recipe `category`. Use `type = 'all'` to show all recipes:

```
-- config/tables.lua
{
    id   = 'workbench_1',
    type = 'all',           -- Shows ALL recipes
}
```

#### Target not working (ox\_target)

**Solution:**

1. Make sure `Config.Target = 'ox'` (not `'false'` string)
2. Make sure ox\_target starts before elenacraft
3. Check F8 console for `[Craft] ox_target yüklendi` message

***

#### Mouse stuck on screen

**Cause:** NUI focus not properly released.

**Solution:** Press ESC or type in chat to release focus. If persistent, restart the resource

```
restart elenacraft
```

#### Distance check failed

**Solution:** Increase the max distance:

```
Config.Security.maxTableDistance = 15.0
```

#### Batch craft gives wrong amount

**Solution:** Make sure `server/main.lua` has the correct `Security.StartCraft` call with amount parameter:

```
local started = Security.StartCraft(src, recipeId, tableId, effTimeTotal, amount)
```

And `craft:complete` gets amount BEFORE `CompleteCraft`:

```
local activeCraft = Security.GetActiveCraft(src)
local amount = (activeCraft and activeCraft.amount) or 1
-- THEN call CompleteCraft
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://elena-scripts.gitbook.io/elenascripts/gameplay/craft-system/troubleshooting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
