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.
Where the code appears
Section titled “Where the code appears”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/#e101With --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"]}}Summary
Section titled “Summary”| Code | Exit | Title |
|---|---|---|
| E101 | 2 | missing variable |
| E102 | 2 | request cannot be built |
| E103 | 2 | request file has errors |
| E104 | 2 | bad directive value |
| E105 | 2 | authentication failed |
| E106 | 2 | body file problem |
| E107 | 2 | @ref problem |
| E200 | 2 | error |
| E201 | 2 | unknown request |
| E202 | 2 | several requests match |
| E203 | 2 | bad flag or argument |
| E204 | 2 | unknown environment |
| E205 | 2 | project configuration problem |
| E206 | 2 | TLS configuration problem |
| E207 | 2 | proxy configuration problem |
| E208 | 2 | session or cookie store problem |
| E209 | 2 | bad data file |
| E210 | 2 | cannot read or write a file |
| E211 | 2 | import failed |
| E212 | 2 | feature file problem |
| E213 | 2 | needs a terminal |
| E214 | 2 | server could not start |
| E215 | 2 | mock could not be built |
| E300 | 3 | request failed |
| E301 | 3 | could not connect |
| E302 | 3 | timed out |
| E303 | 3 | TLS handshake failed |
| E304 | 3 | protocol problem |
| E305 | 3 | cancelled |
E1xx: the request
Section titled “E1xx: the request”E101 missing variable
Section titled “E101 missing variable”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.
E102 request cannot be built
Section titled “E102 request cannot be built”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.
E103 request file has errors
Section titled “E103 request file has errors”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.
E104 bad directive value
Section titled “E104 bad directive value”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.
E105 authentication failed
Section titled “E105 authentication failed”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.
E106 body file problem
Section titled “E106 body file problem”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.
E107 @ref problem
Section titled “E107 @ref problem”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.
E2xx: the command and project
Section titled “E2xx: the command and project”E200 error
Section titled “E200 error”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.
E201 unknown request
Section titled “E201 unknown request”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.
E202 several requests match
Section titled “E202 several requests match”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.
E203 bad flag or argument
Section titled “E203 bad flag or argument”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
E204 unknown environment
Section titled “E204 unknown environment”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.
E205 project configuration problem
Section titled “E205 project configuration problem”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.
E206 TLS configuration problem
Section titled “E206 TLS configuration problem”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.
E207 proxy configuration problem
Section titled “E207 proxy configuration problem”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.
E208 session or cookie store problem
Section titled “E208 session or cookie store problem”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.
E209 bad data file
Section titled “E209 bad data file”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.
E210 cannot read or write a file
Section titled “E210 cannot read or write a file”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.
E211 import failed
Section titled “E211 import failed”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.
E212 feature file problem
Section titled “E212 feature file problem”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.
E213 needs a terminal
Section titled “E213 needs a terminal”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.
E214 server could not start
Section titled “E214 server could not start”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.
E215 mock could not be built
Section titled “E215 mock could not be built”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.
E3xx: the network
Section titled “E3xx: the network”E300 request failed
Section titled “E300 request failed”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.
E301 could not connect
Section titled “E301 could not connect”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.
E302 timed out
Section titled “E302 timed out”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.
E303 TLS handshake failed
Section titled “E303 TLS handshake failed”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.
E304 protocol problem
Section titled “E304 protocol problem”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.
E305 cancelled
Section titled “E305 cancelled”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.
Validate diagnostics
Section titled “Validate diagnostics”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.
| Code | Meaning |
|---|---|
ambiguous-step | a # @step phrase that matches the same text as another step |
bad-assert | # @assert that is not selector op value |
bad-auth | an # @auth spec that does not parse |
bad-auth-config | a 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-auth | auth.default in apic.yaml does not parse |
bad-graphql | a GraphQL request (GRAPHQL method or X-REQUEST-TYPE: GraphQL) without a query, or whose variables block is not a JSON object |
bad-header | a line in the header section that is not Name: value |
bad-http-version | a request line whose HTTP version is not HTTP/1.1 or HTTP/2 |
bad-multipart | a multipart/form-data body without a boundary, or whose parts are not laid out between --boundary delimiters |
bad-name | # @name without a value |
bad-ref | a # @ref or # @forceRef whose target is not one request in the project |
bad-retry | a # @retry (or retry in apic.yaml) that is not <attempts> [interval] |
bad-save-path | a >> file after the body with no path, a path outside the project, or a second one on the same request |
bad-sleep | a # @sleep whose value is not a duration such as 500ms or 2s |
bad-step | a # @step phrase that does not parse |
duplicate-name | a request name used more than once in the project |
editor-script | an editor-only script or redirect block (skipped, not sent) |
exec-disabled | # @auth exec without auth.allowExec in apic.yaml |
missing-body-file | a < file body, or a < file part of a multipart body, whose file does not exist |
missing-schema-file | a # @assert … matchesSchema <file> whose schema file does not exist or lies outside the project |
orphan-directives | directives that are not followed by a request line |
ref-cycle | a # @ref chain that leads back to the request it started from |
unknown-auth-key | a field of a Security.Auth configuration that apic does not act on |
unknown-directive | a # @directive apic does not know (ignored) |
unknown-selector | a 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