Reference
Errors
Every error the CLI and the generated code can throw, grouped by where it comes from, with what it means and what to do.
The generated helpers throw plain Errors with a fixed message. There are no custom error classes, so match on the message. For step-by-step fixes, see Troubleshooting.
ts
try {
await const login: () => Promise<{
identityKey: string;
}>
login()
} catch (var err: unknownerr) {
const const message: stringmessage = var err: unknownerr instanceof var Error: ErrorConstructorError ? var err: Errorerr.Error.message: stringmessage : var String: StringConstructor
(value?: any) => string
String(var err: unknownerr)
if (const message: stringmessage.String.startsWith(searchString: string, position?: number): booleanstartsWith('login failed:')) {
// the server answered 401: sign again, or check the server's identity
} else if (const message: stringmessage.String.startsWith(searchString: string, position?: number): booleanstartsWith('API ')) {
// network or response limits: see the apiClient.ts table below
} else throw var err: unknownerr
}CLI#
Config problems are prefixed Invalid config: and exit with code 1.
| Message | Meaning |
|---|---|
a new project needs at least a frontend or a backend |
custom starter with no stack. Pick full-stack, or pass --frontend and/or --backend |
target directory is not empty: … |
new mode only writes into an empty folder. Use another folder or add mode |
unknown starter: … / unknown capability: … |
typo in an id. See Starters and Capabilities |
starter … is a complete example and does not accept generated capabilities |
drop --capabilities for complete examples |
cannot infer separate client/server targets from a single package containing both react and express; use --file with explicit targets |
use --file with targets |
name is required |
a --file config needs "name" |
--network must be main, test, or ttn (and the same for --mode, --frontend, --backend, --package-manager) |
invalid flag value |
… requires a value / unknown option: … / unexpected argument: … |
flag syntax. --help lists every flag |
config file not found: … / cannot read config file: … / invalid JSON in … |
the --file path or contents |
targets.client must be a safe relative path / invalid bsvDir: … |
no absolute paths, no .. |
command failed (…): … |
a step such as git clone or npm install failed. Its own output is just above |
apiClient.ts#
Thrown by apiFetch and readApiJson in the browser.
Identity and login#
| Message | From | Meaning |
|---|---|---|
failed to fetch server identity: <status> |
getServerIdentity |
GET /api/identity didn't return 2xx. Is the server up? |
server returned an invalid identity response |
serverIdentity.ts |
the response wasn't exactly { identityKey } |
server returned an invalid identity key |
serverIdentity.ts |
not a valid compressed public key |
connect a wallet first (initializeWallet / relay) |
useWalletLogin |
login() called with no wallet |
connect a wallet first |
useSignedRequest |
signedFetch() called with no wallet |
login failed: <status> |
useWalletLogin |
the server rejected the proof |
server returned another wallet identity |
login | the verified key isn't the connected wallet's |
No authenticated desktop wallet found |
walletAcquisition.ts |
caught internally; the UI moves to No desktop wallet found |
useWallet must be used within WalletProvider |
WalletContext.tsx |
wrap your app in <WalletProviders> |
useWalletConnection must be used within WalletConnectionProvider |
WalletConnectionContext.tsx |
same |
Server responses#
| Status | Body | Meaning |
|---|---|---|
401 |
{ "error": "invalid proof" } |
the proof failed: why |
400 |
from express.json |
malformed JSON, or a body over 64 kB |
Client config#
Thrown when the client bundle loads, which shows as a blank page.
VITE_API_URL is required in productionVITE_API_URL must be credential-free HTTPS (or exact HTTP localhost development)VITE_BSV_NETWORK must be main, test, or ttn
Server config#
Thrown at startup.
SERVER_PRIVATE_KEY is required in productionSERVER_PRIVATE_KEY must use its canonical encodingCLIENT_ORIGIN is required in productionCLIENT_ORIGIN must be credential-free HTTPS (or exact HTTP localhost development) originPORT must be an integer from 1 to 65535BSV_NETWORK must be main, test, or ttnJWT_SECRET must contain at least 32 bytes(only if you add the session pattern)