Errors reference
Every error is a real HTTP status with a problem-details body (RFC 9457), Content-Type: application/problem+json. Every response, an error or not, carries the header X-Correlation-Id: the value the request sent in that header, or one the gateway made. The same value is in the body and in the access line of the request (see Logs reference), so one value finds both.
The fields of the body:
type: what kind of error, as an address underhttps://slay400.dev/problems/;about:blankfor a request the listener refused by itself (413, 414).title: the kind in words, the same for every error of that type.status: the HTTP status.detail: only when there is something to add: the program’s message for a program error, the count of problems for an invalid request.instance:urn:slay400:request:and the correlation ID.code: the program’s error code, for a program error only.errors: for an invalid request, one entry per problem: thefield, acodeand amessage.tenantandenvironment: once the gateway knows them.correlationId: as in the header.
Nothing of IBM i reaches a body: no message ID, library, job, or text of an escape message. The access line names the problem, and the gateway’s warnings give more for the operator.
Each response below was recorded from the gateway by a test of this repository, with the mock backend of the shop example. The 500 and the 502 come from a stub of the program call, since a mock cannot produce them. Where the gateway made the correlation ID itself, it is written <generated>.
The Community Edition never answers 401 or 403: authentication is not part of it.
400 The request is not valid
Section titled “400 The request is not valid”A parameter is missing, has the wrong type, is too long, or the body is not JSON. errors lists every problem at once, so that one correction fixes them all. Correct the request: the OpenAPI document of the bundle says what each operation takes.
HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
X-Correlation-Id: example-request-invalid
{"type":"https://slay400.dev/problems/request-invalid","title":"The request is not valid","status":400,"detail":"The request has 1 problem; see errors.","instance":"urn:slay400:request:example-request-invalid","errors":[{"field":"quantity","code":"REQ007","message":"Body field must be a whole number"}],"tenant":"acme","environment":"test","correlationId":"example-request-invalid"}
400 Request line or headers too large
Section titled “400 Request line or headers too large”The request line or the headers are over the listener’s limit. The listener answers before the request reaches the pipeline, so the body has no tenant or environment and the correlation ID is one the gateway made. Send fewer or shorter headers.
HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
X-Correlation-Id: <generated>
{"type":"https://slay400.dev/problems/request-invalid","title":"The request is not valid","status":400,"instance":"urn:slay400:request:<generated>","correlationId":"<generated>"}
404 Not found
Section titled “404 Not found”No tenant, environment or route matches the address, or the bundle of the route was removed. Check the address against /<tenant>/<environment>/<route> (see URLs and routes). The body names no tenant or environment when they are the part that did not match.
HTTP/1.1 404 Not Found
Content-Type: application/problem+json
X-Correlation-Id: example-not-found
{"type":"https://slay400.dev/problems/not-found","title":"Not found","status":404,"instance":"urn:slay400:request:example-not-found","correlationId":"example-not-found"}
404 or another status: the program reported an error
Section titled “404 or another status: the program reported an error”The program reported a business error, and the error mapping of its api.yaml gives this error code its own status (statusByCode); here E404 is answered with 404. The body is the one of a program error (422 below), with the status of the mapping.
HTTP/1.1 404 Not Found
Content-Type: application/problem+json
X-Correlation-Id: example-program-error-mapped
{"type":"https://slay400.dev/problems/program-error","title":"The program reported an error","status":404,"detail":"Order not found","instance":"urn:slay400:request:example-program-error-mapped","code":"E404","tenant":"acme","environment":"test","correlationId":"example-program-error-mapped"}
405 Method not allowed
Section titled “405 Method not allowed”The route exists, but not for this method. The header Allow lists the methods it takes.
HTTP/1.1 405 Method Not Allowed
Allow: GET
Content-Type: application/problem+json
X-Correlation-Id: example-method-not-allowed
{"type":"https://slay400.dev/problems/method-not-allowed","title":"Method not allowed","status":405,"instance":"urn:slay400:request:example-method-not-allowed","tenant":"acme","environment":"test","correlationId":"example-method-not-allowed"}
413 Request body too large
Section titled “413 Request body too large”The body is over the listener’s limit. The listener answers as soon as it reads Content-Length, without reading the body.
HTTP/1.1 413 Request Entity Too Large
Content-Type: application/problem+json
X-Correlation-Id: <generated>
{"type":"about:blank","title":"Request Entity Too Large","status":413,"instance":"urn:slay400:request:<generated>","correlationId":"<generated>"}
414 Address too long
Section titled “414 Address too long”The request line is over the listener’s limit of 8 KiB.
HTTP/1.1 414 Request-URI Too Long
Content-Type: application/problem+json
X-Correlation-Id: <generated>
{"type":"about:blank","title":"Request-URI Too Long","status":414,"instance":"urn:slay400:request:<generated>","correlationId":"<generated>"}
422 The program reported an error
Section titled “422 The program reported an error”The program ran and reported a business error through the convention of its api.yaml (error): code and detail are the program’s error code and message. The default status of a program error is 422; the mapping can set another one.
HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json
X-Correlation-Id: example-program-error
{"type":"https://slay400.dev/problems/program-error","title":"The program reported an error","status":422,"detail":"Order refused","instance":"urn:slay400:request:example-program-error","code":"E999","tenant":"acme","environment":"test","correlationId":"example-program-error"}
500 Internal server error
Section titled “500 Internal server error”Something failed inside the gateway that it did not expect. The body says nothing of the cause; the gateway logs the access line with status 500. If it happens again, report it with the correlation ID.
HTTP/1.1 500 Internal Server Error
Content-Type: application/problem+json
X-Correlation-Id: example-internal-error
{"type":"https://slay400.dev/problems/internal-error","title":"Internal server error","status":500,"instance":"urn:slay400:request:example-internal-error","tenant":"acme","environment":"test","correlationId":"example-internal-error"}
502 The program call failed
Section titled “502 The program call failed”The program call failed: the program is missing, the sign-on was refused, IBM i returned an escape message, or the program returned data the API cannot represent. The body does not say which; the gateway’s warning does, without values.
HTTP/1.1 502 Bad Gateway
Content-Type: application/problem+json
X-Correlation-Id: example-program-call-failed
{"type":"https://slay400.dev/problems/program-call-failed","title":"The program call failed","status":502,"instance":"urn:slay400:request:example-program-call-failed","tenant":"acme","environment":"test","correlationId":"example-program-call-failed"}
503 Service unavailable
Section titled “503 Service unavailable”The environment cannot call a program right now: the IBM i is not reachable, or every connection of the pool is in use. Try again later; if it lasts, check the system and pool.maxConnections.
HTTP/1.1 503 Service Unavailable
Content-Type: application/problem+json
X-Correlation-Id: example-service-unavailable
{"type":"https://slay400.dev/problems/service-unavailable","title":"Service unavailable","status":503,"instance":"urn:slay400:request:example-service-unavailable","tenant":"acme","environment":"test","correlationId":"example-service-unavailable"}
504 The program did not answer in time
Section titled “504 The program did not answer in time”The program did not answer within callTimeoutSeconds of its environment. The call is given up; what the program did on IBM i is not undone.
HTTP/1.1 504 Gateway Timeout
Content-Type: application/problem+json
X-Correlation-Id: example-program-timeout
{"type":"https://slay400.dev/problems/program-timeout","title":"The program did not answer in time","status":504,"instance":"urn:slay400:request:example-program-timeout","tenant":"acme","environment":"test","correlationId":"example-program-timeout"}