# Troubleshooting: npx @lawdeshield/cli init

> Every npx @lawdeshield/cli init message — “the code expired (10 minutes). Run npx @lawdeshield/cli init again.”, approval-page errors, framework detection and “✗ LAWDE did not store the test error” — with its meaning and fix.

Source: https://www.lawde.net/docs/troubleshooting/cli

Each message below is quoted exactly as the CLI or the lawde.net approval page shows it. Browser sign-in failures print after “Browser sign-in did not finish:”. For a dry run that changes nothing, add `--dry-run`.

## Messages

### `Browser sign-in did not finish: the code expired (10 minutes). Run npx @lawdeshield/cli init again.`

- Where: npx @lawdeshield/cli init output
- Message: `Browser sign-in did not finish: the code expired (10 minutes). Run npx @lawdeshield/cli init again.`
- What it means: Nobody approved the code on lawde.net within 10 minutes. Each code works once.
- Fix:
  - Run `npx @lawdeshield/cli init` again and approve the new code. Or paste a key: `npx @lawdeshield/cli init --paste`.

### `Browser sign-in did not finish: the request was denied on lawde.net.`

- Where: npx @lawdeshield/cli init output
- Message: `Browser sign-in did not finish: the request was denied on lawde.net.`
- What it means: Someone clicked Deny on the approval page. No key was created.
- Fix:
  - Run `npx @lawdeshield/cli init` again and approve, if the code matches the one in your terminal.

### `Browser sign-in did not finish: lost contact with <url>.`

- Where: npx @lawdeshield/cli init output
- Message: `Browser sign-in did not finish: lost contact with <url>.`
- What it means: The CLI could not reach LAWDE many times in a row while waiting for approval.
- Fix:
  - Check your connection or proxy, then run `npx @lawdeshield/cli init` again, or use `--paste`.

### `Browser sign-in did not finish: could not reach <url> (<error>).`

- Where: npx @lawdeshield/cli init output
- Message: `Browser sign-in did not finish: could not reach <url> (<error>).`
- What it means: The CLI could not connect to LAWDE to get a sign-in code.
- Fix:
  - Check your connection. Behind a company proxy, paste a key instead: `npx @lawdeshield/cli init --paste`.

### `Too many sign-in codes from this network. Try again in a few minutes.`

- Where: Browser sign-in (HTTP 429), printed after “Browser sign-in did not finish:”
- Code: `rate_limited`
- Message: `Too many sign-in codes from this network. Try again in a few minutes.`
- What it means: Your network asked for many sign-in codes in a short time.
- Fix:
  - Wait a few minutes, or paste a key: `npx @lawdeshield/cli init --paste`.

### `Browser sign-in is not available right now. Paste a key instead (--paste).`

- Where: Browser sign-in (HTTP 503)
- Code: `unavailable`
- Message: `Browser sign-in is not available right now. Paste a key instead (--paste).`
- What it means: LAWDE could not start browser sign-in.
- Fix:
  - Run `npx @lawdeshield/cli init --paste` and paste a key from [Settings → API keys](https://www.lawde.net/settings/api-keys).

### `Unknown code. Run npx @lawdeshield/cli init again.`

- Where: Browser sign-in (HTTP 404)
- Message: `Unknown code. Run npx @lawdeshield/cli init again.`
- What it means: LAWDE has no record of this sign-in code.
- Fix:
  - Run `npx @lawdeshield/cli init` again.

### `This code was already used.`

- Where: Browser sign-in (HTTP 410)
- Message: `This code was already used.`
- What it means: A key was already issued for this code. Each code works once.
- Fix:
  - Run `npx @lawdeshield/cli init` again for a new code.

### `This code cannot be used. Run npx @lawdeshield/cli init again.`

- Where: Browser sign-in (HTTP 409)
- Message: `This code cannot be used. Run npx @lawdeshield/cli init again.`
- What it means: The code is no longer in a state that can issue a key.
- Fix:
  - Run `npx @lawdeshield/cli init` again.

### `This code was not found, was already used, or expired. Run npx @lawdeshield/cli init again.`

- Where: Approval page on lawde.net
- Code: `NOT_FOUND`
- Message: `This code was not found, was already used, or expired. Run npx @lawdeshield/cli init again.`
- What it means: The code in the link is unknown, already used, or older than 10 minutes.
- Fix:
  - Run `npx @lawdeshield/cli init` again and open the new link.

### `Only people who can manage API keys in this workspace can approve.`

- Where: Approval page on lawde.net
- Code: `FORBIDDEN`
- Message: `Only people who can manage API keys in this workspace can approve.`
- What it means: Your role in this workspace cannot create keys.
- Fix:
  - Ask the workspace owner to approve, or to give you permission to manage API keys.

### `Pick the app this key is for.`

- Where: Approval page on lawde.net
- Code: `APP_REQUIRED`
- Message: `Pick the app this key is for.`
- What it means: Each key from browser sign-in is made for one app.
- Fix:
  - Choose the app, then approve. No apps? Create one on [Apps](https://www.lawde.net/apps) and reload the page.

### `That app is paused by your plan limits. Activate it in Settings first.`

- Where: Approval page on lawde.net
- Code: `APP_DORMANT`
- Message: `That app is paused by your plan limits. Activate it in Settings first.`
- What it means: The workspace has more apps than its plan allows, and this app is paused.
- Fix:
  - Activate the app in Settings, or pick another app.

### `Your plan allows <limit> active keys. Choose one to replace.`

- Where: Approval page on lawde.net
- Code: `KEY_LIMIT`
- Message: `Your plan allows <limit> active keys. Choose one to replace.`
- What it means: The workspace already has as many active keys as its plan allows.
- Fix:
  - Pick a key to replace on the approval page, or revoke one in [Settings → API keys](https://www.lawde.net/settings/api-keys).

### `No package.json in <folder>. Run this in your app's folder, or pass --cwd.`

- Where: npx @lawdeshield/cli init output
- Message: `No package.json in <folder>. Run this in your app's folder, or pass --cwd.`
- What it means: The command ran outside a Node project.
- Fix:
  - `cd` into your app, or pass `--cwd <folder>`.

### `Could not tell which framework this is (looked for Next.js, Express, Medusa v2 or a Node entry file). Run it in your app folder or pass --cwd <folder>; for a Node server, pass --entry <file>.`

- Where: npx @lawdeshield/cli init output
- Message: `Could not tell which framework this is (looked for Next.js, Express, Medusa v2 or a Node entry file). Run it in your app folder or pass --cwd <folder>; for a Node server, pass --entry <file>.`
- What it means: The project has a package.json but no Next.js, Express, Medusa v2 or Node entry file the CLI recognises.
- Fix:
  - For a Node server, pass the file that starts it: `npx @lawdeshield/cli init --entry src/server.js`.
  - Other stacks: use the [manual setup](https://www.lawde.net/docs/getting-started#manual-setup) or the [HTTP API](https://www.lawde.net/docs/sdk/http).

### `Several packages found. Run again with --cwd <package folder>.`

- Where: npx @lawdeshield/cli init output (with --yes)
- Message: `Several packages found. Run again with --cwd <package folder>.`
- What it means: In a monorepo with more than one app, `--yes` cannot choose for you.
- Fix:
  - Pass the package folder: `npx @lawdeshield/cli init --yes --cwd apps/web`.

### `Could not find your server entry file. Run again with --entry <file>, or create lawde.js yourself:`

- Where: npx @lawdeshield/cli init output (Express / Node)
- Message: `Could not find your server entry file. Run again with --entry <file>, or create lawde.js yourself:`
- What it means: The CLI could not find the file that starts your server, so it printed the file to create instead of writing it.
- Fix:
  - Run again with `--entry <file>`, or create the printed `lawde.js` and import it first in your entry file.

### `No API key. Pass --key <key> or set LAWDE_API_KEY.`

- Where: npx @lawdeshield/cli init output (with --yes)
- Message: `No API key. Pass --key <key> or set LAWDE_API_KEY.`
- What it means: With `--yes` there is no one to approve in the browser or paste a key, and no key was given.
- Fix:
  - Set `LAWDE_API_KEY` in the environment (safer than `--key`, which stays in shell history), or run without `--yes`.

### `--app must be an app ID (a UUID). Find it on the app page in the dashboard.`

- Where: npx @lawdeshield/cli init output
- Message: `--app must be an app ID (a UUID). Find it on the app page in the dashboard.`
- What it means: `--app` or `LAWDE_APP_ID` is set to something that is not an app ID, such as the app’s name.
- Fix:
  - Copy the app ID from [Apps](https://www.lawde.net/apps), or leave `--app` out and use browser sign-in, which sets it for you.

### `<install command> failed (exit <code>). Nothing else was changed.`

- Where: npx @lawdeshield/cli init output
- Message: `<install command> failed (exit <code>). Nothing else was changed.`
- What it means: Your package manager could not install `@lawdeshield/agent`. The CLI stopped before writing any file.
- Fix:
  - Fix the install error printed above it, then run again. Or install by hand and pass `--no-install`.

### `✗ LAWDE did not store the test error: <reason>`

- Where: npx @lawdeshield/cli init output (test error)
- Message: `✗ LAWDE did not store the test error: <reason>`
- What it means: LAWDE did not confirm it stored the test error, so the CLI shows ✗, never ✓. The reason wraps the ingest reply, for example “the API key was rejected (Invalid or revoked API key.).” Look up the message in brackets on the [API key](https://www.lawde.net/docs/troubleshooting/api-keys), [app](https://www.lawde.net/docs/troubleshooting/apps) or [limits](https://www.lawde.net/docs/troubleshooting/limits) page.
- Fix:
  - Fix the cause in brackets, then run `npx @lawdeshield/cli init` again. Files already written are left unchanged.

### `the API key was rejected (<message>).`

- Where: npx @lawdeshield/cli init output (test error reason, HTTP 401)
- Message: `the API key was rejected (<message>).`
- What it means: LAWDE refused the key. The bracket holds the ingest message, such as “Invalid or revoked API key.”
- Fix:
  - See [Invalid or revoked API key](https://www.lawde.net/docs/troubleshooting/api-keys#invalid-or-revoked-api-key).

### `a limit was reached (<message>).`

- Where: npx @lawdeshield/cli init output (test error reason, HTTP 429)
- Message: `a limit was reached (<message>).`
- What it means: A rate limit or the workspace quota stopped the test error.
- Fix:
  - See [Limits and quotas](https://www.lawde.net/docs/troubleshooting/limits).

### `LAWDE answered without confirming the error was stored.`

- Where: npx @lawdeshield/cli init output (test error reason)
- Message: `LAWDE answered without confirming the error was stored.`
- What it means: LAWDE answered with success but without the issue ID that confirms storage, so the CLI does not claim it worked.
- Fix:
  - Run `npx @lawdeshield/cli init` again. If it repeats, check `--url` (or `LAWDE_URL`) points at https://www.lawde.net.

### `✗ No API key, so no test error was sent.`

- Where: npx @lawdeshield/cli init output
- Message: `✗ No API key, so no test error was sent.`
- What it means: The run ended without a key, so nothing could be checked against LAWDE.
- Fix:
  - Run again and approve in the browser, paste a key with `--paste`, or set `LAWDE_API_KEY`.
