Troubleshooting
Common issues and how to fix them.
Fast Lookup
| Symptom | Most likely fix |
|---|---|
| Nothing starts | Run fexapi init in a project root |
| Generate fails | Fix fexapi/schema.fexapi and rerun fexapi generate |
| Server says no generated schema | Run fexapi generate first |
| Sidebar routes look wrong | Check route precedence in Configuration |
| Watch mode does not reload | Confirm fexapi dev --watch and the file is in the watch list |
| Port conflict | Pick a different --port value |
Quick Diagnosis Checklist
Run these in order when something feels off:
fexapi --help
fexapi generate
fexapi dev --watch --logIf generate fails, fix schema errors first. If the server starts but responses are unexpected, check route source and watch logs.
"Could not find package.json"
Cause: You are running the CLI outside a Node project root (or nested directory without a parent package.json).
Fix:
- Run commands from your app/project root (where
package.jsonexists) - Or initialize a Node project first:
npm init -y
fexapi initpnpm init
fexapi initbun init -y
fexapi inityarn init -y
fexapi init"Schema file not found: .../fexapi/schema.fexapi"
Cause: You ran generate or serve before initialization.
Fix:
fexapi init
fexapi generate
fexapi serve"No generated schema found..."
Cause: fexapi/.cache/generated.api.json does not exist yet.
Fix: Run:
fexapi generateThen restart the server.
"Route not found" (404)
Cause: The requested path doesn't match any defined route.
Fix:
- Check the 404 response — it lists all available routes
- Make sure you ran
fexapi generateafter editing your schema - Verify the HTTP method matches (
GET /userswon't matchPOST /users)
"Expected schema routes, but config routes are being used"
Cause: Route overlap between generated schema routes and fexapi.config.js.
Fix:
- Review the canonical precedence rules in Configuration
- Keep your source-of-truth route in
fexapi/schema.fexapi - Remove overlapping path entries in
fexapi.config.jsroutes - Regenerate and restart
"No routes defined in schema.fexapi"
Cause: The schema file exists but has no valid route definitions.
Fix:
- Check the syntax of
fexapi/schema.fexapi - Each route needs:
METHOD /path: field:type - Run
fexapi formatto normalize the file
Port and route precedence
See Configuration for the single source of truth on config, generated schema, and CLI flag precedence.
Port already in use
Cause: Another process is using the same port.
Fix:
fexapi serve --port 5000Or stop the other process using that port.
Windows (find process on a port):
netstat -ano | findstr :4000
taskkill /PID <pid> /FmacOS/Linux:
lsof -i :4000
kill -9 <pid>CORS errors in browser
Cause: CORS is not enabled.
Fix: Add cors: true to your fexapi.config.js:
module.exports = {
cors: true,
};Schema type errors
Cause: Using an invalid field type.
Valid types: number, string, boolean, date, uuid, email, url, name, phone
GET /users:
age:integer # ❌ invalid
age:number # ✅ correctConfig file not loading
Cause: FexAPI can't find fexapi.config.js from the current project root.
Fix:
- Make sure the config file is in the project root (where you run the command)
- Check file naming — it must be
fexapi.config.js
Watch mode not reloading
Cause: The changed file isn't in the watched file list.
Watched files:
fexapi/schema.fexapifexapi/.cache/generated.api.jsonfexapi.config.jsfexapi/schemas/*.yamlandfexapi/schemas/*.yml- other files under
fexapi/(restart only)
Make sure you're using fexapi dev --watch (not fexapi serve).
If schema parsing fails while watching, the server keeps running with the last valid generated state. Fix the schema and save again.
Faker method not applied
Cause: Invalid Faker path in YAML (for example typo in faker: person.fullname).
Fix:
- Use valid Faker method paths such as
person.fullName,internet.email,image.avatar - Keep
typeset correctly even when usingfaker - Restart
dev --watchor rerunserve
