Troubleshoot a Broken Setup
This guide covers the most common issues you will encounter when developing with Guren and how to fix them quickly. When something goes wrong, start here before diving into individual package documentation.
Troubleshoot a Broken Setup
This guide covers the most common issues you will encounter when developing with Guren and how to fix them quickly. When something goes wrong, start here before diving into individual package documentation.
Quick Diagnostic
Run the built-in doctor command to identify problems automatically:
bunx guren doctor
The doctor checks route-controller-page consistency, missing dependencies, configuration issues, and more. It prints actionable suggestions next to each finding.
For a detailed report with recommended next steps:
bunx guren doctor --next
Common Issues
"Cannot find module @guren/core"
Cause: Dependencies are not installed or the lockfile is out of date.
Fix:
bun install
If you recently switched branches or pulled large changes, also rebuild:
bun run build
Type errors after upgrading Guren
Cause: Stale build artifacts from the previous version conflict with the new types.
Fix:
bun run build:clean
This removes all dist/ directories and rebuilds every package in the correct dependency order. Always use build:clean after upgrading or switching branches.
Codegen not updating
Cause: The codegen cache may be stale, or new routes and pages have not been detected.
Fix:
bun run codegen --force
The --force flag bypasses the cache and regenerates all manifests from scratch. If the issue persists, check that your route file (routes/web.ts) exports a valid route registrar function.
"Connection refused" when accessing the database
Cause: The Postgres container is not running, or DATABASE_URL points to the wrong host or port.
Fix:
Start the database container:
docker compose up -dVerify the connection string in
.env:DATABASE_URL=postgres://guren:guren@localhost:54322/gurenThe default port is
54322(not the standard5432) to avoid conflicts with system Postgres.Confirm the container is healthy:
docker compose ps
"CSRF token mismatch"
Cause: The session middleware is not registered, or the frontend is not sending the CSRF token with requests.
Fix:
Confirm session middleware is registered in your application bootstrap. The
add authgenerator does this automatically, but if you set up manually, ensurecreateSessionMiddlewareis in your providers.On the frontend, verify that forms include the CSRF token. Inertia pages handle this automatically. For custom fetch requests, include the token from the cookie:
fetch('/api/endpoint', { method: 'POST', headers: { 'X-CSRF-Token': getCsrfToken(), 'Content-Type': 'application/json', }, body: JSON.stringify(data), })See the CSRF Guide for full details.
"Validation failed" with no useful error message
Cause: The validation schema does not match the shape of the incoming request body.
Fix:
Check that your Zod schema matches the field names your frontend sends:
// If the frontend sends { userName: "..." } // then the schema must use userName, not username const Schema = z.object({ userName: z.string().min(1), })In development, validation errors return a 422 response with a JSON body listing each field and its error. Inspect the response body in your browser's network tab.
See Validation for more patterns.
"Page not found" for a route that exists
Cause: The codegen manifests are out of date, or the controller method name does not match the route definition.
Fix:
Regenerate manifests:
bun run codegen --forceRun the consistency check:
bunx guren checkThis reports any routes that reference missing controllers or methods.
Verify that the controller method name in your route matches the actual method in your controller class:
// Route router.get('/posts', [PostController, 'index']) // Controller — method must be named "index" export class PostController extends Controller { async index() { /* ... */ } }
Dev server starts but pages are blank
Cause: The Vite dev server is not running, or SSR rendering is failing silently.
Fix:
Make sure
bun run devstarts both the Bun backend and the Vite dev server. Check yourpackage.jsonscripts.Open the browser console for JavaScript errors.
If using SSR, check the terminal output for server-side rendering errors — they appear in the Bun process logs, not the browser.
Migration fails with "relation already exists"
Cause: A previous migration partially applied, or you manually created the table.
Fix:
Check migration status:
bunx guren db:migrate:statusIf you need to start fresh in development:
bunx guren db:resetThis drops all tables, re-runs all migrations, and optionally re-seeds.
Warning
db:reset destroys all data. Only use it in development.
Reading Doctor Output
The doctor command groups findings by severity:
- Error — must be fixed before the app can run correctly (e.g., a route references a controller that does not exist)
- Warning — the app runs but may behave unexpectedly (e.g., a page component exists but is not referenced by any route)
- Info — suggestions for improvement (e.g., unused imports)
Each finding includes a description and a suggested fix. Apply the suggestions, then re-run bunx guren doctor to confirm the issues are resolved.
When Nothing Else Works
If none of the above solves your problem:
Delete
node_modulesand reinstall:rm -rf node_modules bun.lock bun install bun run build:cleanCheck the CLI Reference for additional diagnostic commands.
Run
bunx guren contextto generate a project map you can share when asking for help.