Skip to content

Errors

Every error apic reports carries a stable code. A script or an agent can branch on the code rather than on the wording of the message, which may improve from release to release; a code never changes meaning, and new ones are only added.

The first digit groups them: E1xx is the request as written, E2xx the command and the project around it, E3xx the network. The exit status follows from the code: 2 for E1xx and E2xx, 3 for E3xx (see exit codes). A failed assertion is not an error: it exits 1 and is reported in the result.

Under the message, with the catalogue’s hint when the message does not already name an apic command to run (dim on a terminal, plain in a log):

error: auth.http:9: missing variable
{{token}}: pass --var token=... or add it to http-client.env.json
hint: Pass it with --var name=value, add it to an env file, or run the request that captures it first.
E101 missing variable · see https://apic.sh/errors/#e101

With --json, as one object on stderr (stdout keeps only results, so a pipe into jq is not disturbed):

{"error":{"code":"E101","title":"missing variable","message":"auth.http:9: missing variable\n {{token}}: it is captured by request …","hint":"Pass it with --var name=value, …","exit":2,"url":"https://apic.sh/errors/#e101"}}

Over MCP, a failed tool call carries the same object as its structured content, and its text ends with the code, title and hint.

When the error is about a name that matches nothing but is close to one that exists (a request id, the target of a # @ref or an environment, with a typo, the wrong case or _ for -), the message asks “did you mean” and the object carries the closest names, best first, under suggestions; an agent can retry with the first rather than listing. The key is absent when nothing is close.

{"error":{"code":"E201","title":"unknown request","message":"no request named \"get-usr\"; did you mean get-user? (run `apic list` for every id)","hint":"Run apic list …","exit":2,"url":"https://apic.sh/errors/#e201","suggestions":["get-user"]}}
CodeExitTitle
E1012missing variable
E1022request cannot be built
E1032request file has errors
E1042bad directive value
E1052authentication failed
E1062body file problem
E1072@ref problem
E2002error
E2012unknown request
E2022several requests match
E2032bad flag or argument
E2042unknown environment
E2052project configuration problem
E2062TLS configuration problem
E2072proxy configuration problem
E2082session or cookie store problem
E2092bad data file
E2102cannot read or write a file
E2112import failed
E2122feature file problem
E2132needs a terminal
E2142server could not start
E2152mock could not be built
E3003request failed
E3013could not connect
E3023timed out
E3033TLS handshake failed
E3043protocol problem
E3053cancelled

Exit 2. A {{placeholder}} in the request has no value from any source: --var, the environment’s entry in the env files, .env, the session, or a request earlier in the same run. The message names each missing variable and, when another request’s # @capture provides it, that request. A # @ref to that request makes it run first by itself; apic describe <request> shows where every variable comes from.

What to do: Pass it with —var name=value, add it to an env file, or run the request that captures it first.

Exit 2. The request’s text could not be turned into a request: a built-in with bad arguments ({{$randomInt 5 1}}), an unknown built-in, a URL that does not parse once its placeholders are filled in, or a GraphQL body whose variables are not a JSON object.

What to do: Check the placeholder, URL, header or body the message names.

Exit 2. The .http file failed to parse where the request is: a malformed directive, a multipart body without a boundary, a GraphQL request without a query. apic refuses to send from a file with errors rather than guess; apic validate lists them all.

What to do: Run apic validate to see every problem with its line and column.

Exit 2. A directive is well formed but its value cannot be used: # @timeout soon, # @retry 0, # @sleep -1s, an # @assert that does not parse, an HTTP version other than HTTP/1.1 or HTTP/2 on the request line, or HTTP/2 over plain http://.

What to do: Fix the directive’s value; https://apic.sh/format/ lists what each takes.

Exit 2. The request’s auth could not be applied: an # @auth spec that does not parse, # @auth exec without auth.allowExec, an OAuth2 token endpoint that refused the grant, a browser sign-in with no terminal, or a JetBrains Security.Auth configuration that does not exist or cannot be used.

What to do: Check the # @auth spec (or auth.default), its credentials, and the token endpoint.

Exit 2. A file the request reads could not be used: a < file body, a multipart part’s file, or a schema for matchesSchema. Paths are relative to the .http file and must resolve (symlinks included) inside the project root, so a request file cannot read something outside it.

What to do: Check that the file exists, relative to the .http file, and lies inside the project.

Exit 2. A # @ref or # @forceRef names no request, several requests, or leads back to the request it started from. apic validate reports these as bad-ref and ref-cycle before anything runs.

What to do: Point # @ref at exactly one request, and break any cycle.

Exit 2. An error without a more specific code. It should be rare: if you meet one, the message is worth an issue so it can get a code of its own.

What to do: The message says what went wrong; if it is unclear, please open an issue.

Exit 2. The target names no request: no # @name of that name, no such .http file, or no request at that position in the file. When a known name is close to the one given (a typo, the wrong case, _ for -), the message asks “did you mean” and the --json object lists them under suggestions, best first; otherwise the message lists what there is: the request ids, the files, or the named requests of the file given.

What to do: Run apic list to see the request ids, and use name, file.http, file.http#name or file.http#N.

Exit 2. The command works on one request (describe, curl, snippet) and the target names a whole file or a name used in several files.

What to do: Pick one with file.http#name, or give the command a single request.

Exit 2. A flag has a value the command cannot use, two flags cannot be combined (--output with a flow or --data, --use-session with --no-session), an argument is missing or extra, a history entry number names no entry, or the command does not exist.

What to do: Check the command’s flags with apic —help.

Exit 2. --env (or env: in apic.yaml) names an environment that neither env file declares, or there are no env files at all. The message lists the environments found and, when one is close to the name given, asks “did you mean”; the --json object lists those under suggestions. apic env shows each environment with its files.

What to do: Use one of the environments the message lists, or add it to http-client.env.json.

Exit 2. The project could not be loaded: apic.yaml or an env file is not valid YAML/JSON, or a setting in it (a timeout, a retry policy) cannot be read.

What to do: Fix apic.yaml or the env file the message names; apic validate helps.

Exit 2. A TLS setting cannot be used: a CA file with no PEM certificates, a certificate or key that does not load, a key that is world-readable or needs a passphrase apic cannot supply, or a path outside the project.

What to do: Check the CA file, client certificate and key the message names.

Exit 2. --proxy, proxy: in apic.yaml or HTTP(S)_PROXY holds a URL apic cannot use. apic refuses the request rather than send it directly.

What to do: Give the proxy as an http, https, socks5 or socks5h URL.

Exit 2. .apic/session.json, the cookie jar or the response history in .apic/history could not be read or written, or a session command ran with --no-session.

What to do: Check .apic/ is writable, or run with —no-session.

Exit 2. The rows for apic run --data could not be read: an empty file, a header column without a name, a row with the wrong number of fields, or JSON that is not an array of objects.

What to do: Give —data a CSV file with a header row, or a JSON array of objects.

Exit 2. A file named on the command line (a report, a data file, a file to format, stdin) could not be read or written.

What to do: Check the path and its permissions.

Exit 2. apic import could not read what it was given, or refused to overwrite files without --force.

What to do: Check the input is an OpenAPI 3 document, a Postman v2 collection or a curl command.

Exit 2. apic test could not run the features: no .feature files, a feature that does not parse, an invalid tag expression, a step table or variable name it cannot use, or a step naming a target that is not a request.

What to do: Check the feature files, the step text and the tag expression.

Exit 2. apic ui is interactive: it refuses --json and a stdout that is not a terminal.

What to do: Run apic ui in a terminal; use apic run or apic list —json in scripts.

Exit 2. apic mcp --http, apic demo or apic mock could not listen where it was asked to.

What to do: Check the address or port is free and allowed.

Exit 2. apic mock could not use the document it was given: it is not OpenAPI 3, a $ref in it does not resolve, or it declares no operations to serve.

What to do: Check the file is an OpenAPI 3 document with at least one operation under paths.

Exit 3. The request could not complete for a reason none of the E3xx codes below describes.

What to do: The message has the underlying error; check the URL and the network.

Exit 3. The host name did not resolve, the connection was refused or reset, or the network is unreachable. Nothing reached the server.

What to do: Check the host name, the port and that the server is running.

Exit 3. The server did not answer within the timeout (30 seconds unless --timeout, timeout: in apic.yaml or # @timeout says otherwise).

What to do: Raise —timeout, # @timeout or timeout: in apic.yaml, or check the server.

Exit 3. The TLS handshake failed: the server’s certificate is not trusted, has the wrong name or has expired, or the server refused the client certificate. --insecure skips verification for one command, as a last resort.

What to do: Trust the server’s CA with —cacert or tls.caFile, or check the client certificate.

Exit 3. The server’s answer could not be used: it did not negotiate HTTP/2 for a request line that asks for it, the response was malformed, or the body was larger than apic reads.

What to do: Check the server speaks what the request asks for.

Exit 3. The run was interrupted (Ctrl-C, or esc in the UI) while a request, a # @sleep or a retry wait was in progress. A flow prints its summary so far, the session and the history keep what the completed requests captured and returned, and --report is still written. A second Ctrl-C ends the process at once.

What to do: Run the command again.

apic validate reports problems in the files before anything runs, each with a line, a column and one of these codes (the code key of validate --json). They are a separate namespace from the E codes above: a file with an error-severity diagnostic refuses to run with E103.

CodeMeaning
ambiguous-stepa # @step phrase that matches the same text as another step
bad-assert# @assert that is not selector op value
bad-authan # @auth spec that does not parse
bad-auth-configa JetBrains Security.Auth configuration in an env file that apic cannot use (not OAuth2, the Implicit grant, a missing Token URL or Client ID)
bad-capture# @capture that is not name = selector
bad-config-authauth.default in apic.yaml does not parse
bad-graphqla GraphQL request (GRAPHQL method or X-REQUEST-TYPE: GraphQL) without a query, or whose variables block is not a JSON object
bad-headera line in the header section that is not Name: value
bad-http-versiona request line whose HTTP version is not HTTP/1.1 or HTTP/2
bad-multiparta multipart/form-data body without a boundary, or whose parts are not laid out between --boundary delimiters
bad-name# @name without a value
bad-refa # @ref or # @forceRef whose target is not one request in the project
bad-retrya # @retry (or retry in apic.yaml) that is not <attempts> [interval]
bad-save-patha >> file after the body with no path, a path outside the project, or a second one on the same request
bad-sleepa # @sleep whose value is not a duration such as 500ms or 2s
bad-stepa # @step phrase that does not parse
duplicate-namea request name used more than once in the project
editor-scriptan editor-only script or redirect block (skipped, not sent)
exec-disabled# @auth exec without auth.allowExec in apic.yaml
missing-body-filea < file body, or a < file part of a multipart body, whose file does not exist
missing-schema-filea # @assert … matchesSchema <file> whose schema file does not exist or lies outside the project
orphan-directivesdirectives that are not followed by a request line
ref-cyclea # @ref chain that leads back to the request it started from
unknown-auth-keya field of a Security.Auth configuration that apic does not act on
unknown-directivea # @directive apic does not know (ignored)
unknown-selectora selector that is not status, statusText, duration, header., cookie., body or body.$*, or a body path apic cannot read

Hosted on Cloudflare, which keeps aggregate traffic statistics. No cookies, no tracking scripts, no per-request logs. Privacy