check rules
The check tool validates a project in four layers — syntax, code gate, contract rules, typecheck; this page covers when it runs, when it blocks a deploy, and the main rules by area.
Each rule matches a kind of mistake that once crashed an app or failed a deploy. Errors block a deploy; warnings don’t.
Layers
check runs the cheapest layers first.
1. Syntax parses every .ts / .tsx file → syntax errors with line numbers
2. Code gate patterns that crash the app or leave the stack → code.* rules (errors) + quality warnings
3. Contract route tree, UI ↔ API match, .ts/.tsx boundary, handler schemas
4. Typecheck full TypeScript — only with check({ typecheck: true }), ~5–15 sEach result line shows the layer, the rule id (when there is one), the file, the line and the fix:
✗ 2 error(s)
Errors:
- [gate:code.antd-v6-no-visible-prop] app/orders/page.tsx:42 <Modal visible={…}> — antd v6 Modal ignores `visible`, so it never opens. Use `open={…}` …
- [contract] app/orders/page.tsx FE calls GET /orders/stats but no matching BE route found
Warnings:
- [gate:perf.order-unindexed] app/orders/repository.ts:18 orders.createdAt is used in orderBy but …When check runs
- On every
write_files— the first three layers run inside the same call and the result comes back with it. Your agent fixes the findings in its next call. - When you call
check— the first three layers; addtypecheck: trueto run the typecheck too. Run the typecheck once at the end of each phase, not after every file. - On
deploy— all four layers run, the typecheck included, and the deploy is refused while errors remain. Type errors are the only ones you can override, withdeploy({ force: true, reason })when you are sure the app still works; errors from the first three layers cannot be overridden. The exception: a file tree that was already deployed successfully can always be deployed again, so you can roll back.
UI and stack
| Rule | Meaning |
|---|---|
code.no-mui, code.no-shadcn | Imports MUI or shadcn/ui — use antd and pro-components. |
code.no-tailwind-import | Imports a Tailwind package or a Tailwind-based UI kit — write utility classes directly in className. |
code.no-css-import | Imports a .css file — apps have no CSS files; use antd tokens. |
code.undefined-component | Uses <Name /> that is neither imported nor declared — the page crashes with ”… is not defined”. |
code.antd-v6-no-visible-prop | antd v6 Modal, Drawer, Dropdown, Tooltip, Popover and Popconfirm ignore visible — the overlay never opens; use open. Your own components and ModalForm / DrawerForm are not flagged. |
code.no-pagecontainer-onback | onBack on PageContainer/PageHeader crashes the page — render your own back button. |
Calling the API from the UI
| Rule | Meaning |
|---|---|
code.invalid-api-method | Calls api.<resource>.<method>() that the generated client doesn’t have; the message lists the valid methods. The deploy build checks again against the client it generates and refuses the deploy if a call is still wrong. |
| (contract) | The UI calls a path that no handler serves. |
File tree
| Rule | Meaning |
|---|---|
code.no-app-api-folder | A file under app/api/ — the tree is flat: app/<resource>/<method>.ts. |
code.no-framework-file-emit | Hand-written app/db.ts, app/api.ts or app/hooks.ts — manh.run generates these. |
code.reserved-std-path | A file under manh/ — that folder is reserved for built-in services. |
config.wrong-extension | app/auth.tsx or app/upstream.tsx — config files must be .ts; manh.run never reads the .tsx. |
shared.impure-import | A file in app/shared imports something other than app/shared/*, manh/enum, manh/flow and manh/vn (such as app/db, react, manh/env) or uses window, document, localStorage. |
shared.not-tsx | A .tsx file or JSX in app/shared — that folder holds plain .ts only. |
| (contract) | A .tsx file imports a server-only module, or a .ts file imports React. app/shared/* is the one folder both sides import. |
Server and database
| Rule | Meaning |
|---|---|
code.runtime-import | Imports a runtime module other than import { env } from "manh/env" — that is the only runtime import allowed. |
code.backend-package-not-allowed | The package isn’t on manh.run’s server list; the message lists the allowed packages. |
code.no-remote-import | Imports from a URL (https://…, esm.sh, the old esm.town/v/std/* URLs) — not supported; built-in services live at manh/*. |
code.unknown-std-import | Imports an manh/<name> that doesn’t exist (such as manh/oauth) — sign-in is declared in app/auth.ts (email/password; add providers: ["google"] for Google). |
code.no-dayjs-in-backend | Uses dayjs in a .ts file — it exists only in the UI; use Date on the server. |
code.no-async-transaction | db.transaction(async …) — the async callback isn’t awaited and errors don’t roll back; use a synchronous callback. |
| (contract) | A handler reads body or a field that its schema doesn’t declare. |
A missing import of eq, and, desc and similar from app/db is not an error: the build adds it.
Security and sign-in
| Rule | Meaning |
|---|---|
code.hardcoded-secret | A string in code looks like a real API key — set the secret in the dashboard and read it as env.NAME. |
code.no-reserved-env | Reads a reserved name (OPENAI_*, FT_* and others) — manh.run’s keys aren’t in the app; use manh/*. |
auth.config-invalid | app/auth.ts has the wrong shape: no roles, a defaultRole outside roles, an unknown signup or providers value, or values that aren’t literals. |
access.invalid | export const access isn’t "public", "user" or a literal array of role names. |
access.unknown-role | access names a role that isn’t in roles of app/auth.ts. |
auth.signed-in-redirect-loop | Warning: a sign-in page goes home whenever a user exists (useEffect(() => { if (user) nav("/") }, [user])). If anything on the home page still sees nobody signed in, the two pages bounce forever. Navigate right after signIn(…) in the submit handler, or only when the session starts while the page is open. |
code.jwt-verify-alg | verify(token, secret) without "HS256" — every request fails sign-in. |
tenant.removed | The app has an app/tenant.ts. manh.run no longer has a multi-tenant mode: one app, one database. Delete the file; when each client needs separate data, clone the app per client, or scope rows by an org column (orgId). |
Cron
| Rule | Meaning |
|---|---|
code.cron-missing-schedule | A .cron.ts file has no export const schedule — the job never runs. |
code.cron-invalid-schedule | The schedule doesn’t have exactly 5 fields (minute hour day month weekday, in UTC). |
Sample data
| Rule | Meaning |
|---|---|
sample.template-unchanged | The project was made from a template and the app was changed for its new owner, but spec/sample-data.json is still the template’s (another business’s customers, products and places). Write a new file for the owner’s business in one write_files call: keep the tables and columns the message lists, 80 KB at most. The deploy loads it into the empty tables; if the app was deployed already, delete the old sample rows with db_exec first. |
Common warnings
Warnings don’t block a deploy, but they point at what to fix.
| Rule | Meaning |
|---|---|
code.missing-frontend | No .tsx files yet — expected while you build the data and API phases. |
code.no-inline-drizzle-in-handler | A handler calls db.select/insert… directly — move the query into repository.ts. |
perf.order-unindexed | A list sorts by a column with no index — it slows down as the table grows. Not reported when an index (composite included) starts with the sorted column or with the column the query filters on with eq, when the query filters by an indexed foreign key with .limit(n) of 50 or less, and for the users table generated from app/auth.ts. |
list.unbounded | A hand-written pageSize schema has no .max(…) — one request could read the whole table. Use listSchema() from app/db (caps it at 100) or add .max(100). |
code.hardcoded-color | A hard-coded color in style — take it from theme.useToken() (token.colorTextLightSolid for white text on a colored fill, token.colorBgMask for a dark scrim); use Typography.Text type for red/green text and Tag color for status labels. White, black or rgba overlays on a background image are not flagged. |
seo.missing-meta | A public page has no title / description in meta. When the app has sign-in, only pages in the layout’s PUBLIC_PAGES-style list are reported; the login, register and users pages never are; meta = { noindex: true } in app/layout.tsx covers every page below it. |
code.no-raw-useapi-on-own-backend | Uses useApi() to call the app’s own API — it works, but prefer the typed useApiClient() from app/api. |
code.no-direct-sqlite-core-import | Imports from drizzle-orm/sqlite-core — the build rewrites it to app/db, but import from app/db. |
code.antd-v6-no-bodystyle-prop, code.antd-v6-no-headstyle-prop, code.antd-v6-no-dropdownclassname-prop, code.antd-v6-no-tabpane-jsx, code.antd-v6-no-menu-item-jsx | Older antd v6 spellings that still work — prefer styles={{ body, header }}, classNames={{ popup: { root } }}, items={[…]}. |
code.antd-responsive-xs-only | A table column with responsive: ["xs"] alone — antd shows it only on phones (under 576 px), never on a computer. Write responsive: ["xs", "sm"] to show it on every screen. |
access.public-write | A write handler (POST, PUT, PATCH, DELETE) has access = "public" — anyone can call it. |
sample.quality | spec/sample-data.json has rows that contradict each other or look made up: an id with no row in the file (classes[3].teacher_id = 9 but teachers has no id 9), a child row whose ids differ from its parent’s (attendance in a class other than its session’s), a child marked in a class it is not enrolled in, \n written as two characters (the page shows “\n”), phones like 0900000001, @example.com addresses, “Lorem ipsum”, one name repeated on many rows, or a table with a list screen and no rows (that screen is empty at handover). Names table, row and column; at most 8 lines. Fix the sample file so rows agree, with real, varied names and numbers. |
sample.runtime-rewrite | Server code that updates data and quotes 3 or more values of spec/sample-data.json (a “normalise sample data” button) — rewriting sample rows at runtime breaks half-way. Delete it and rewrite the sample file. |
Good to know
- While syntax errors remain, most code gate rules pause — fix syntax first, then run again.
deployruns the typecheck too, so a type error blocks the deploy. Runcheck({ typecheck: true })before you hand the app over to see type errors early, not at deploy time.- This page lists the main rules, not all of them. Every message includes the fix.
Built-in hints
hint.* warnings name a framework feature that already does what a file writes by hand. They never block. One per kind per project:
hint.useAction— repeated try /message.error(e.response.data.message)around API calls →useActionfromapp/hooks.hint.std-vn— hand-written Vietnam time (+7h) or money formatting →manh/vn.hint.mail-html— a hand-written HTML escape in mail code →htmlandmailFramefrommanh/email.hint.csv-export— a hand-made CSV download → blockexport-excel.hint.numbering— document codes built withpadStart→ blocknumbering.hint.flow-history— a from/to status history table →Flow.movereturns the row to store; show it on the record page with<ActivityLog>frommanh/shell.hint.row-scope— the same role-based row filter in several queries →scopeByfromapp/db.
Next steps
- How manh.run works — where
checksits between code and a running app. - Why the stack is fixed — why the stack rules exist.
- The app/ tree — valid file types and paths.
Last updated