# Diagnose QBCore resource load order

Start database and framework dependencies before the resources that call them. Use manifests and
the first startup error to derive the order; do not copy an arbitrary flat list.

## Evidence to collect

- The first error after a clean server start, including resource and file name
- Relevant `ensure` lines and bracketed groups from `server.cfg`
- Each affected `fxmanifest.lua`, including `dependency` declarations
- The exact deployed commit for every resource in the dependency chain

## Diagnostic

1. Run `refresh`, then `ensure` the first failing resource and read the first error.
2. If an export is missing, confirm the provider is started and the export exists at the deployed commit.
3. Inspect manifest dependencies. For example, current `qb-core` declares `oxmysql`.
4. Expand group folders such as `[qb]`, `[standalone]`, and `[voice]`; the group name does not prove
   that one resource inside it starts before another.
5. Compare the generated `server.cfg` with the pinned recipe before moving lines.

The current official recipe ensures `qb-core`, then the `[qb]`, `[standalone]`, `[voice]`, and
`[defaultmaps]` groups. Individual resources can still need explicit ordering within those groups.
See the [annotated server.cfg reference](/docs/installation/server-config) for the complete current template.

## Fix and verify

Move or add only the provider needed by the first failure. Restart from a clean process, verify all
required resources report `started`, then test the affected user flow and inspect the console again.

For a newly added third-party resource, continue with
[rpCrate's QBCore script installation and testing checklist](https://rpscripts.net/setting-up-qbcore-scripts/).
It covers configuration, locales, dependency order and staging checks with privileged and unprivileged
accounts, including a resource restart. rpCrate and qbcore.net are operated by the same owner; use
the resource's own README and release notes for version-specific instructions.

## Rollback

Restore the previous `server.cfg` and commit set. If an update included SQL, restore the matching
database backup rather than mixing old code with a new schema.

## Sources

- [Official txAdmin recipe](https://github.com/qbcore-fivem/txAdminRecipe/blob/0f4f6d96bf707ef9de123afd59a4233504befab1/qbcore.yaml)
- [qb-core manifest](https://github.com/qbcore-fivem/qb-core/blob/9b3cddcce93e5e12cbcf6b47b866b687d32ac7bf/fxmanifest.lua)
