kq validate
Runs every rule in Validation on the model, exactly as kq build would build it, and writes nothing. Each finding is one line: the file, line and column, the severity, the rule and what is wrong.
kq validate [options] <path>...
Arguments
| Argument | Is |
|---|---|
<path>... | A file or folder of each model to check. |
Options
| Option | Does |
|---|---|
--strict | Fail on a lint as well as an error. |
--format <format> | How findings are written: a text line each, a GitHub Actions workflow command each, or one SARIF 2.1.0 log on standard output. One of text, github, sarif. Default text. |
--as-of <yyyy-mm-dd> | Judge policies as of this day instead of today, to reproduce a past run or see what a later date breaks: an exemption past its until lifts nothing. |
--require-license | Fail with exit 3 where a policy set needs a feature no license grants, instead of skipping it with a warning. |
Environment
| Variable | Does |
|---|---|
KANONIQ_TELEMETRY | off, 0 or false stops kq reporting the run; so does DO_NOT_TRACK=1. |
Exit codes
| Code | Means |
|---|---|
0 | Done |
1 | Failed: the model has an error, a check found a change, or a file could not be read or written |
2 | Usage error: an unknown command or option, a missing or extra argument, a path that does not exist, or an output folder kq will not clear |
3 | A paid feature that no license found grants |
$ kq validate models/my-model
models\my-model\model\shop.kq:12:5 error KQ023 Connection over grpc lands on Interface "CRM API" (shop/crm/crm-api), a HttpApi; grpc reaches a GrpcApi
validated 1 model, 1 failed
It exits with 1 on any error. A lint doesn't fail it unless you add --strict:
kq validate --strict models/my-model # fails on a lint too
Then, on a model with no error, it checks your policies, where policies in kanoniq.repository.json turns them on, as it does in a new repository. Their findings follow the rest under a policy findings: line, each with its severity, info, warn or error, and its id, and the last line counts them. A policy finding at error makes it exit with 1; --strict never makes a policy warn fail. Your own policy sets are checked only with a license for a paid plan; without one they are skipped, and kq says so once, with a link to what a paid seat adds. With --require-license, a skipped set makes it exit with 3 instead, for CI that must not pass on rules it never checked. kq build and kq audit take it too. --as-of 2027-06-30 checks them as of that day instead of today: to see what a later date breaks, such as an exemption that has run out, or to repeat an earlier run.
Where the model holds any assumptions, the summary line ends with how many, such as 4 assumptions, 2 carried: the elements and relationships you marked, then what was created or derived from them. The count never changes the exit code, and --strict does not read it. In a SARIF log the two numbers are in the KQ run's properties.
Given a directory that isn't inside a repository, such as a folder of several, it validates each model under it separately. A model with no kanoniq.repository.json at or above it, a loose model, is still read here, as it is by kq fmt, the editor and the previews; kq build, kq prune, kq arrange and kq portal:build refuse one and say to run kq init (KB060). A .kq file in a repository but outside model/ is an error (KB055).
Output for CI
--format github writes one GitHub Actions workflow command per finding, so a pull request shows each on its line, and --format sarif one SARIF 2.1.0 log for code scanning; the exit code stays the same. See kq validate in GitHub Actions and SARIF in code scanning.
© 2026 Extenza Works. All rights reserved.