> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gatojs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Known limitations

> Known gaps in GatoJS, their impact and how to work around them: mutation testing, deployment, the CLI, kit modules, auth and more.

These are behaviours of the kit that are known gaps, not bugs in your code. Some can be closed by a change in the kit; others are the price of a deliberate design decision. Each entry says what you will see and how to work around it. If one of them blocks you, [open an issue](https://github.com/webamigos/gatojs/issues).

## High priority

> [accordion] Integration mutation runs may over-count killed mutants
>
> **Impact.** `npm run test:mutation:integration`, and the critical-files gate that merges its report, can count a mutant as killed when no test detected it. Stryker runs a type-checking process plus one test process, then adds a second test process when type checking finishes. Both use the same `INTEGRATION_DATABASE_URL`, and every test starts by resetting the database, so one process can wipe the other's data mid-test. The result is inflated, never deflated: a surviving mutant is trustworthy, a mutant killed only in the integration run is not.
>
> **Workaround.** Treat mutants killed only in the integration run as unconfirmed. Do not run `npm run test:integration` or a second Stryker run against the same database at the same time.

> [accordion] Railway may ignore railway.toml, and a deploy without migrations looks healthy
>
> **Impact.** Railway's file-based "Config as Code" is being retired: new services do not read `railway.toml`, so the pre-deploy migration, healthcheck and restart policy from the file are not applied. The image still builds and `node server.js` starts, so the deploy looks fine, but the database has no tables and every sign-in fails. The same happens when a project did not commit its migrations: `prisma migrate deploy` with no migrations exits with `0`, and `/api/healthcheck` (`SELECT 1`) passes on an empty database.
>
> **Workaround.** Enter the settings from `railway.toml` in the Railway service settings by hand, commit your migrations, and check the migration log after the first deploy. See [Railway](https://docs.gatojs.com/deployment/railway.md).

## CLI

> [accordion] gato add does not fill in .env
>
> **Impact.** After `gato add api-keys` or `gato add uploads`, the module's variables are added only to the `wa:modules` region of `.env.example`; `.env` is unchanged and the CLI does not mention it. With `api-keys`, the app refuses to start until `API_KEY_PEPPER` is set. With `uploads`, development works with the `local` provider, but production startup requires `STORAGE_LOCAL_PATH`. Likewise, `gato remove` and `gato update` leave `.env` alone.
>
> **Workaround.** After `add` or `update`, copy new variables from `.env.example` to `.env` and set real values. After `remove`, delete them from `.env` and production settings. See [Environment variables](https://docs.gatojs.com/configuration/environment-variables.md).

> [accordion] API\_KEY\_PEPPER is never generated, and cannot be rotated
>
> **Impact.** `gato create` generates only `BETTER_AUTH_SECRET`. The `API_KEY_PEPPER` example value is rejected with `NODE_ENV=production`, which stops the whole app, not just the module. API keys are stored as HMAC-SHA256 with one pepper, so changing it invalidates every key (requests get 401, while the list still shows them as active), and there is no transition period with two peppers.
>
> **Workaround.** Set a random pepper of at least 32 characters before the first deploy (for example `openssl rand -base64 32`) and keep it stable per environment. After a forced change, organizations issue new keys and delete the old ones. See [API keys](https://docs.gatojs.com/modules/api-keys.md).

> [accordion] gato update cannot add a module that a newer kit starts to require
>
> **Impact.** If the target kit version adds a `requires` entry to an installed module for a module you do not have, `gato update` stops with `Moduł <x> w wa-kit <version> wymaga niezainstalowanych modułów: <list>`. `gato add` cannot help when that module exists only in the newer kit, because `add` fetches the kit at your current version.
>
> **Workaround.** Carry the kit changes over by hand. Kit maintainers avoid adding such `requires` to existing modules.

> [accordion] Other CLI gaps
>
> | Limitation | Impact | Workaround |
> | - | - | - |
> | Most CLI messages are in Polish | Error and status messages are hard to read without the reference | See [Exit codes and messages](https://docs.gatojs.com/cli/exit-codes.md) |
> | `--title` and `--admin-email` are not validated or escaped | A title with double quotes breaks `src/shared/config/project.ts` and `EMAIL_FROM`; `--title=` gives an empty name; a title containing `wa-app` or `wa_app` is rewritten | Use a plain title and a non-empty address |
> | `create` without a terminal needs `--yes` even with every option given | The setup question has no "no" flag, so CI stops with `Brak terminala: użyj --yes` | Pass `--yes` (or `--no-install`) |
> | `create` needs `git` even with `--no-git` | The kit's file list comes from `git ls-files` | Install git |
> | A failure after assembly in `create` is not rolled back | A failed `.env` write, `git init`, `npm install` or setup leaves the project directory, and later steps are not printed. After a setup without an admin email there is no reminder to run `admin:create` | Run the missing steps by hand ([`gato create`](https://docs.gatojs.com/cli/create#rollback-and-its-limits)) |
> | `add` fetches the kit before its refusals | Adding an installed module with a bad `--kit` reports a source error; with the default source even a refusal needs network | Check `gato list` first; the installed section works offline |
> | A failure in `generate` or `npm install` during `add` is not rolled back | Files are copied and recorded, but generated files or `node_modules` are stale | Fix the cause, run `npx gato generate` or `npm install` |
> | A dangling symlink where a module directory should go | `add` fails with a raw `ENOENT` or `ENOTDIR` instead of the collision list | Remove the symlink |
> | A dependency in the other `package.json` section | `add` adds it to the module's section too, without a warning | Check the `package.json` diff |
> | `remove` has no rollback | A failure midway (for example permissions) leaves some files deleted and the module still in `.wa/kit.json` | Fix the cause and run `remove` again; missing files do not block it |
> | `remove` drops dependencies your code uses | A module's dependency is removed if no other manifest declares it in the same section, even if you use it or changed its version | Declare it in a [project module](https://docs.gatojs.com/cli/kit-json.md#project-modules) manifest |
> | `list` exits with `0` when the kit cannot be fetched | Scripts cannot rely on the exit code | Check for the `Dostępne: nie udało się pobrać kitu` line |
> | Git output above CLI messages | A failed clone shows git's raw error; a successful one may show a `… is not a commit!` warning, several times in `update` | Read the last line |
> | A local kit checkout is matched by version only | A checkout on another commit with the same version is used; uncommitted edits to tracked files are copied | Use a clean checkout at the project's tag |
> | `update` in a subdirectory of a larger repository | The clean-tree check covers the whole repository | Commit or stash everywhere; `--dry-run` works anyway |
> | `update` does not write through symlinks | A symlink on any path it would write stops it before any change | Replace the symlink with a real file or directory |
> | `package-lock.json` after `update` | Updated only by `npm install`, so it stays stale with `--no-install` or after conflicts | Run `npm install` before committing |
> | Module version bumps are a convention | Changing a module's files without bumping its `version` passes every gate | Reviewers check it ([Releases](https://docs.gatojs.com/contributing/releases.md)) |

## Modules

> [accordion] Audit log and file storage grow without cleanup
>
> **Impact.** `audit-logs` has no retention: nothing deletes old entries, and they disappear only with their organization. `uploads` leaves orphaned objects with both providers: when a user uploads a file and does not save the form (the upload happens on selection), when an entity is deleted without `deleteUploadCommand`, when deleting an object or rolling back a write fails, when an organization is deleted (records cascade, stored objects stay), and after `gato remove uploads` with a migration that drops the table.
>
> **Workaround.** Implement retention in your project, for example a periodic query that deletes entries older than your retention period. Find orphaned objects by comparing storage keys with the `key` column of the `uploads` table, and call `deleteUploadCommand` when you delete an entity. Retention and cleanup are planned for the background jobs module ([Roadmap](https://docs.gatojs.com/roadmap.md)).

> [accordion] The local storage provider: one instance, a durable directory, no migration between providers
>
> **Impact.** The default `local` provider writes files to the server's disk:
>
> * A second app instance does not see the first one's files, so an upload on one and a download from the other gives 404.
> * The directory must survive restarts and deploys. Startup rules require a volume on Railway and an absolute `STORAGE_LOCAL_PATH` elsewhere, but do not check that the directory is durable or writable; a missing write permission shows up on the first upload as a 500.
> * After changing `STORAGE_PROVIDER`, files stored earlier stay in the old storage and return 404.
> * An absolute path inside `.next/standalone` or a temp directory is accepted, but is wiped by builds or deploys.
> * Path traversal protection is lexical: a symlink inside the storage directory pointing outside it is followed.
>
> **Workaround.** For several instances use `STORAGE_PROVIDER=s3`. Point `STORAGE_LOCAL_PATH` at a persistent volume outside `.next`, choose the provider before the first upload, move files yourself (keeping keys) when you switch, and do not share the storage directory with other processes. See [File storage](https://docs.gatojs.com/deployment/file-storage.md).

> [accordion] One file referenced by two entities
>
> **Impact.** `uploads` does not know which entities reference a file. `deleteUploadCommand` deletes the record and the object without checking references, so a second entity pointing at the same file gets 404.
>
> **Workaround.** Make the file id column unique, or check references before calling `deleteUploadCommand`.

## Auth, roles and organizations

> [accordion] Invitations for people who already have an account
>
> **Impact.** On `/accept-invitation/<id>`, "Sign in" goes to `/sign-in` without a return address and lands on the dashboard; "Create account" with an existing address shows a success message without creating anything. Either way the invitation stays pending. The page also accepts the invitation on a plain GET for a signed-in user, without a confirmation button.
>
> **Workaround.** Sign in first, then open the invitation link from the email again.

> [accordion] The runtime organization guard does not see every query
>
> **Impact.** The guard rejects a query without an organization filter only on guarded models and only through the model delegate (`prisma.apiKey.findMany`, `tx.upload.create`). Raw SQL, nested `include`/`select` and nested writes from a parent model such as `Organization` or `User`, and the `Member` and `Invitation` models pass unchecked. The guard also checks that a filter is present, not that it names the active organization.
>
> **Workaround.** Write raw SQL on organization tables with an `organization_id` condition and an isolation test. Read related domain data starting from a guarded model with an organization filter. Always take `organizationId` from `getOrgContext()` or the API key context, never from input. See [Organizations](https://docs.gatojs.com/concepts/organizations.md).

> [accordion] Service mode confirmation does not cover everything
>
> **Impact.** The confirmation dialog covers kit commands called through `useServiceModeAction().run`. Direct `authClient.organization.*` calls (member management, creating an organization) bypass it; today this does not expose another organization's data, but new superadmin UI built on those calls would. A tab rendered in organization A still writes to organization B after you switch in another tab, outside service mode.
>
> **Workaround.** Build new superadmin UI on kit commands, not `authClient.organization.*`. Do not work in two tabs in different organizations with the same account. See [Superadmin and service mode](https://docs.gatojs.com/concepts/superadmin-and-service-mode.md).

> [accordion] Impersonation and service accounts after a support period
>
> **Impact.** The impersonation log entry is written by the browser, so a direct API call creates a session without it. The Users panel offers only invite and "sign in as"; changing roles and deleting accounts needs the `/api/auth/admin/*` endpoints. Cutting off support access takes several API calls, and an impersonation session (one hour) survives a role change or account deletion.
>
> **Workaround.** Follow the access cut-off procedure in [Handover](https://docs.gatojs.com/deployment/handover.md), and end impersonation (or wait an hour) before cutting access.

> [accordion] Other auth gaps
>
> | Limitation | Impact | Workaround |
> | - | - | - |
> | A global role stored as several values (`admin,superadmin`) | Protected like a superadmin by the admin hooks, but treated as `user` in the app | Give each account a single role |
> | The global role is cached in the session cookie for up to 5 minutes | A demoted admin keeps some admin abilities for up to 5 minutes from an open tab | Force a sign-out, or wait |
> | Password reset tokens are valid for 48 hours | Applies to every reset link, not only the welcome email | None |
> | No index on `verifications.identifier` | Lookups scan the table as it grows | Add `@@index([identifier])` and a migration in your project |
> | A failed membership write after sign-up | Leaves an account without an organization, sent to `/no-organization` | None in the kit |
> | Invitation acceptance at sign-up does not re-check `pending` | An invitation cancelled between the check and the write is marked accepted | None |

## Other

> [accordion] Language detection is on
>
> **Impact.** A URL without a prefix does not always mean Polish. A browser set to English is redirected to `/en/...`, and one visit to `/en/...` sets a `NEXT_LOCALE=en` cookie that redirects later unprefixed URLs too. End-to-end tests do not notice, because Playwright runs with the `pl` locale.
>
> **Workaround.** Open any `/pl/...` URL (which sets the cookie back), delete the cookie, or set `localeDetection: false` in `src/i18n/routing.ts` if you want Polish without a prefix always. See [i18n](https://docs.gatojs.com/guides/i18n.md).

> [accordion] Server action errors are not translated, and there is no localized 404
>
> **Impact.** In the `en` version users see Polish error messages from server actions. A 404 shows the default Next.js page in any language.
>
> **Workaround.** Translate the messages your features return, and add a `not-found` page with translations in your project.

> [accordion] No logs in production without an OTLP endpoint
>
> **Impact.** Production logs go to OpenTelemetry. Without `OTEL_EXPORTER_OTLP_ENDPOINT` nothing is stored, and the log level cannot be configured.
>
> **Workaround.** Set `OTEL_EXPORTER_OTLP_ENDPOINT` in production. See [Logging and observability](https://docs.gatojs.com/configuration/logging-and-observability.md).

> [accordion] HOSTNAME=127.0.0.1 causes a redirect loop
>
> **Impact.** With the standalone server bound to `127.0.0.1`, an unprefixed Polish URL such as `/sign-in` redirects to itself. `/en/...` URLs work and `/api/healthcheck` returns 200, so the healthcheck does not catch it. The default `Dockerfile` sets `HOSTNAME="0.0.0.0"`.
>
> **Workaround.** Keep `HOSTNAME` at `0.0.0.0` (or `::`) and open an unprefixed URL after each deploy. See [Docker](https://docs.gatojs.com/deployment/docker.md).

> [accordion] handleCommandError turns access denials into a generic error
>
> **Impact.** `requireModuleAccess` calls `notFound()` on denial. A command that calls it inside `try` returns the generic failure message, and the log records an error instead of a warning. The denial is safe, but users without access see "something went wrong" and logs cannot tell a denial from an outage. The same applies to `NoOrganizationError`.
>
> **Workaround.** None yet; keep the pattern from [Code patterns](https://docs.gatojs.com/guides/code-patterns.md).

> [accordion] The protect-tests hook protects less than test files
>
> **Impact.** During implementation the hook blocks `__tests__/`, `e2e/` and `*.test.*`/`*.spec.*` files, but not `src/test/` helpers, Vitest, Playwright and Stryker configs, `mutation-gate.json`, the hook itself or `.claude/settings.json`. An implementer could change test behaviour through them.
>
> **Workaround.** Review diffs to those files; `allowed` entries in the mutation gate are approved by a human in the pull request. See [AI agents](https://docs.gatojs.com/guides/ai-agents.md).

> [accordion] Smaller items
>
> | Limitation | Impact | Workaround |
> | - | - | - |
> | `key` in `defineModule` differs from the feature directory name | The menu label is not translated | Name the directory like the `key` |
> | The generator ignores relations to models other than `User` and `Organization`, unknown manifest fields and `env[].required` | A typo goes unnoticed until `prisma validate`, or never | Review region diffs after `generate` |
> | `prisma format` with a missing back-relation | Adds the field below the `wa:relations` region; after `generate` it is defined twice | Add `schemaRelations` instead of running `prisma format` |
> | A feature route starting with `api` or containing a dot | The proxy skips it, so the unprefixed URL is 404 | Do not name routes `api…` or with a dot |
> | Feature variables from `env.ts` are not typed on `env` | `env.NAME` is a TypeScript error; validation still works | See [Environment variables](https://docs.gatojs.com/configuration/environment-variables.md) |
> | A module cannot send its own email without editing the core | The mailer exports only the core emails | Edit the mailer (a core change) or send yourself ([Email](https://docs.gatojs.com/guides/email.md)) |
> | `/api/healthcheck` only queries the database | Passes with a broken environment or an empty schema | Open the sign-in page after a deploy |
> | `prisma` and `dotenv` versions in the `Dockerfile` are hard-coded | They can drift from `package.json` | Update both |
> | No page at `/` | `http://localhost:3000/` is 404 | Go to `/sign-in` |
> | The sign-in form does not link to `/sign-up` | With public sign-up on, users need to know the URL | Link it in your project |
> | `.nvmrc` allows any Node 22, `packageManager` needs npm 11 | Older npm rewrites `package-lock.json` | Use npm 11 |
> | commitlint and Prettier run only in git hooks | `--no-verify` skips them; no workflow runs them | Run `npm run verify` before pushing |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.