Skip to content

Route-scoped error handling

On a JSON:API route, every failure becomes a spec-compliant error document — the application/vnd.api+json media type, a top-level errors array, a string status, and a stable error code — whether it originated in core (an unknown filter, a missing resource, a validation failure), in Symfony (a firewall denial, a routing 404), or anywhere else (an unexpected \Throwable → 500). One listener owns all of it.

The vocabulary of that document — the Error and ErrorSource value objects, the ErrorResponse, the InternalServerError::for() seam, the exception catalogue and its stable codes — is core's. See core errors-and-exceptions. This page documents only what the bundle adds: a route-scoped kernel.exception listener, the Symfony-exception → status mapping, debug gating, and how it composes with the firewall and logging.

The model: a route-scoped kernel.exception listener

ExceptionListener registers on kernel.exception at priority 128 — high enough to win over Symfony's own error handling on JSON:API routes — and is route-scoped: it acts only when the matched route carries the marker _jsonapi (JsonApiRoute::MARKER). Every route the bundle's loader emits stamps that default (see routing); nothing else does. So on any non-JSON:API route the listener returns immediately and Symfony handles the error as usual — the bundle never hijacks the rest of your app.

Two more hooks on the same class back it up. An authentication failure behind a firewall with an entry point is left for Symfony Security's listener at priority 1, and onKernelExceptionAfterFirewall() at priority -64 renders whatever the firewall leaves on the event, still ahead of Symfony's error page at -128. When the entry point returns its own 401, the kernel.response hook onKernelResponse() swaps in the JSON:API body. See authentication and authorization failures.

public function onKernelException(ExceptionEvent $event): void
{
    $request = $event->getRequest();

    if (!JsonApiRoute::matches($request)) {
        // … unless the router refused the method on a JSON:API path, see below
        return;
    }
    // … resolve the server, map the throwable, render the error document
}

The one failure that reaches it with no matched route is a 405 on a JSON:API path, covered in a method the path does not accept.

When the marker is present, the listener resolves the request's server (_jsonapi_server, defaulting to the implicit default — see multi-server-and-testing), maps the throwable to a core ErrorResponse, renders it to PSR-7 via ErrorResponse::toPsrResponse(), and bridges that back to an HttpFoundation Response it sets on the event. No controller, no template — the same render seam the lifecycle's view listener uses on the success path.

The three mapping arms

ExceptionListener::toErrorResponse() is a three-way branch on the throwable:

Throwable Mapped via Status & shape
Core JsonApiExceptionInterface ErrorResponse::fromException($throwable) The exception's own getErrors() / getStatusCode() — the full core error object(s), source and code intact
Symfony HttpExceptionInterface ErrorResponse::fromErrors($this->httpError(...)) A single status-keyed Error with a reason-phrase title (the bundle's match() table) and a debug-only detail. A 401/403 renders as core's AuthenticationRequired/AccessDenied instead, so it carries a code (see authentication and authorization failures)
Anything else (\Throwable) InternalServerError::for($throwable, $debug) A generic 500, byte-identical to core's own middleware 500

Arm 1 — core exceptions render themselves. Anything implementing core's JsonApiExceptionInterface already knows its status and its error objects, so the listener hands it straight to ErrorResponse::fromException(). This is the common case on a JSON:API route: an unknown filter (FILTERING_UNRECOGNIZED, 400), an unrecognized query-parameter family or an unknown fields[type] sparse-fieldset member (QUERY_PARAM_UNRECOGNIZED / FIELDSET_MEMBER_UNRECOGNIZED, 400 — strict query-parameter validation, on by default, see configuration), a missing resource (RESOURCE_NOT_FOUND, 404), an unknown relationship (RELATIONSHIP_NOT_EXISTS, 404), a validation failure (VALIDATION_FAILED, 422 — see validation). The bundle adds nothing to the shape; it only ensures the document is rendered on the JSON:API route instead of being swallowed by framework error handling. The example app's ErrorHandlingTest witnesses several of these end to end:

// GET /albums/999 — the show route matches, the provider's null fetch becomes 404
$error = $this->errorDocument('/albums/999', 404);
self::assertSame('404', $error['status'] ?? null);
self::assertSame('RESOURCE_NOT_FOUND', $error['code'] ?? null);

// GET /tracks?filter[nope]=x — an unrecognised filter
$error = $this->errorDocument('/tracks?filter[nope]=x', 400);
self::assertSame('400', $error['status'] ?? null);
self::assertSame('FILTERING_UNRECOGNIZED', $error['code'] ?? null);
self::assertSame(['parameter' => 'filter[nope]'], $error['source'] ?? null);

Note the 404 detail: GET /albums/999 returns a JSON:API 404 (not a bare Symfony 404) precisely because the albums show route exists and is JSON:API-scoped — the request reaches the handler, the provider returns null, and core raises the 404. A request to a route the loader never emitted (an unknown type) 404s at the router, before this listener is in scope, and renders as Symfony's default.

Arm 2 — Symfony HTTP exceptions get a status-keyed error. A Symfony HttpExceptionInterface carries an HTTP status but no JSON:API error object. The listener builds one with the bundle's own reason-phrase title and — only in debug — the exception message as detail:

private function httpError(HttpExceptionInterface $throwable): Error
{
    $status = $throwable->getStatusCode();

    return new Error(
        status: (string) $status,
        title: $this->reasonPhrase($status),
        detail: $this->debug ? $throwable->getMessage() : '',
    );
}

The reason-phrase table:

Status Title
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable
409 Conflict
415 Unsupported Media Type
422 Unprocessable Entity
429 Too Many Requests
any other >= 500 Server Error
anything else Error

This arm is where the firewall (401/403) and routing (404, 405) land — see the firewall interplay below.

Authentication and authorization failures

A 401 or 403 renders through core's AuthenticationRequired and AccessDenied exceptions, so the error carries a stable code a client can dispatch on, whichever layer refused the request:

Thrown Status code title
AuthenticationException (Security) 401 AUTHENTICATION_REQUIRED Unauthorized
AccessDeniedException (Security), request unauthenticated 401 AUTHENTICATION_REQUIRED Unauthorized
AccessDeniedException (Security), request authenticated 403 ACCESS_DENIED Forbidden
HttpExceptionInterface with status 401, e.g. UnauthorizedHttpException 401 AUTHENTICATION_REQUIRED Unauthorized
HttpExceptionInterface with status 403, e.g. AccessDeniedHttpException 403 ACCESS_DENIED Forbidden

When the firewall has an entry_point, the two unauthenticated rows go to it first, and its 401 keeps every header it set, such as WWW-Authenticate, under the JSON:API body. An HttpExceptionInterface keeps its own headers the same way. See security.

The detail is the exception's message in debug only, as for every other mapped exception. The declarative authorization layer throws AccessDeniedException, so its denials carry these codes too:

{"errors": [{"status": "403", "code": "ACCESS_DENIED", "title": "Forbidden"}]}

Because they carry a code, their title can be localized in the jsonapi_errors translation domain like any other error's (see localizing and overriding error copy).

A method the path does not accept

A PATCH to a read-only type, or a POST to a relationship on one, has no route to match: the bundle emits only the routes a type allows, so the router finds the path and throws a 405 before any route is matched. The request carries no marker, but the listener still owns the error. It asks the router which route each method in the Allow list reaches on that path, and when one of them is a JSON:API route it renders core's MethodNotAllowed under that route's server:

{"errors": [{"status": "405", "code": "METHOD_NOT_ALLOWED", "title": "Method Not Allowed",
  "detail": "The method PATCH is not allowed on this path, which accepts GET."}]}

The response carries the same Allow header the router computed. Like a firewall error, it is answered before content negotiation, so it is a JSON:API document whatever the Accept header asks for. On the atomic endpoint it declares the atomic ext when the request named it on Content-Type or Accept, and is plain JSON:API otherwise. A path whose routes are none of them JSON:API endpoints, such as a controller of your own under the same prefix, keeps Symfony's own 405. The OpenAPI document catalogues METHOD_NOT_ALLOWED but lists no 405 response on any operation, since an operation is one method on one path.

Between arm 1 and arm 2, the listener consults the application-extensible exception mappers (below). Arm 1 always runs first: a core JsonApiExceptionInterface is never intercepted by a mapper or the config map.

Mapping your own exceptions

A domain or third-party exception that is not a core JsonApiExceptionInterface and not a Symfony HttpExceptionInterface falls to the generic 500 by default. Two facets let you map it to a JSON:API error without decorating the listener.

Both are consulted after arm 1 and only for a throwable that is not a core JsonApiExceptionInterface — the invariant being that a core JSON:API exception always renders natively and is never overridden by a mapper or the config map.

Facet 1 — the json_api.exceptions config map

For the common status-only case, map an exception class to an HTTP status in config:

# config/packages/json_api.yaml
json_api:
    exceptions:
        App\Exception\PaymentRequired: 402
        App\Exception\TooManyWidgets: 409

A thrown instance renders as a JSON:API error with that status, the bundle's reason-phrase title, and — only in debug — the exception message as detail (identical in shape to the Symfony HTTP-exception arm). When a throwable matches several mapped classes (a subclass hierarchy), the most-specific (most-derived) mapped class wins.

Facet 2 — a tagged ExceptionMapperInterface

For richer errors (a custom source, meta, multiple error objects, or conditional status), implement ExceptionMapperInterface — a service returns an ErrorResponse, or null to defer to the next mapper:

use haddowg\JsonApi\Response\ErrorResponse;
use haddowg\JsonApi\Schema\Error\Error;
use haddowg\JsonApi\Schema\Error\ErrorSource;
use haddowg\JsonApiBundle\EventListener\ExceptionMapperInterface;

final class PaymentExceptionMapper implements ExceptionMapperInterface
{
    public function map(\Throwable $throwable): ?ErrorResponse
    {
        if (!$throwable instanceof PaymentFailed) {
            return null; // defer to the next mapper
        }

        return ErrorResponse::fromErrors(new Error(
            status: '402',
            code: 'PAYMENT_FAILED',
            title: 'Payment failed',
            detail: $throwable->reason(),
            source: ErrorSource::fromPointer('/data/attributes/card'),
        ));
    }
}

Any service implementing the interface is auto-tagged (json_api.exception_mapper) — no manual tagging needed.

Priority and ordering

The mappers are consulted in descending tag priority order (default 0), first non-null ErrorResponse wins. The bundle's config-driven mapper (the facet-1 json_api.exceptions map) is itself registered as a mapper at a low priority (-1000), so your own mappers (default 0) are always consulted before the config map. To order two of your own mappers, set an explicit tag priority:

services:
    App\Exception\PaymentExceptionMapper:
        tags:
            - { name: json_api.exception_mapper, priority: 10 }

If no mapper returns a response, the listener falls through to arm 2 (Symfony HTTP exceptions) and arm 3 (the generic 500) unchanged.

Arm 3 — everything else is a generic 500. Any other \Throwable is delegated to core's public, stateless InternalServerError::for($throwable, $debug) seam, so the rendered error object is byte-identical to the one core's own ErrorHandlerMiddleware produces — the bundle never re-implements the 500 shape. This is verified directly in the bundle's ExceptionListenerTest, which asserts the listener's output equals the seam's output for the same throwable and debug flag. The throwable is also logged first (see logging below).

Debug gating

Whether an error document carries internal detail is gated on kernel.debug, injected as %kernel.debug%. With debug off (production), the listener redacts:

  • Arm 2 (HTTP exceptions): detail is the empty string — the exception message never reaches the client.
  • Arm 3 (generic 500): core's InternalServerError::for(..., false) emits only the stable status/title (500 / Internal Server Error), with no code, detail, or meta.

With debug on, the 500 becomes verbose: the exception class lands in meta.exception, with file, line, and a trace, the exception code as code, and the message as detail. The example suite boots with kernel.debug = false (the production base case) and asserts no error leaks {exception, file, line, trace} meta:

foreach (['/albums/999', '/tracks/1/bogus', '/tracks?filter[nope]=x'] as $path) {
    $response = $this->handle($path);
    // … each error object:
    self::assertArrayNotHasKey('exception', $meta);
    self::assertArrayNotHasKey('file', $meta);
    self::assertArrayNotHasKey('line', $meta);
    self::assertArrayNotHasKey('trace', $meta);
}

and the bundle's listener test pins both directions of the 500:

// debug off — redacted
self::assertArrayNotHasKey('detail', $error);
self::assertArrayNotHasKey('meta', $error);

// debug on — verbose
self::assertSame('leaky secret detail', $error['detail'] ?? null);
self::assertSame(\RuntimeException::class, $meta['exception'] ?? null);

Keep kernel.debug off in production, as you would on any Symfony app — the gating is your protection against leaking secrets in an unexpected-error trace.

Firewall interplay

Because the listener is route-scoped and a Symfony security denial is an HttpExceptionInterface (401/403), a firewall exception thrown on a JSON:API route renders as a JSON:API error document through arm 2 — not as Symfony's HTML login redirect or access-denied page. Put a firewall in front of your JSON:API routes and a 401/403 still comes back as application/vnd.api+json with a 401/403 status, the matching title and the AUTHENTICATION_REQUIRED/ACCESS_DENIED code. Per-route firewall configuration and JSON:API error rendering compose with no extra wiring — there is a real route and real kernel events, so Symfony's security machinery runs normally (see lifecycle). That includes the firewall's entry point: its challenge headers stay on the JSON:API 401. The example app ships no firewall, so this arm is exercised in the bundle's own functional suite rather than the example tests.

Logging

Unexpected throwables (arm 3 only) are logged before the 500 is rendered:

$this->logger?->error($throwable->getMessage(), ['exception' => $throwable]);

return ErrorResponse::fromErrors(InternalServerError::for($throwable, $this->debug));

The logger service is injected nullOnInvalid(), so the dependency is optional: if no logger is registered, the null-safe ?-> call is a no-op and the 500 still renders correctly — but nothing is logged. Core exceptions (arm 1) and HTTP exceptions (arm 2) are expected outcomes and are not logged; only the genuinely unexpected \Throwable is. If you rely on 500s reaching your logs, ensure a logger (monolog, or any Psr\Log\LoggerInterface service) is wired — it is in any standard Symfony app.

Which path produced your error

Two render paths exist, and the code member tells you which:

  • A core code (RESOURCE_NOT_FOUND, FILTERING_UNRECOGNIZED, VALIDATION_FAILED, REQUEST_BODY_INVALID_JSON, …) means arm 1 — the failure was raised by core (or the bundle's own core-style exceptions) with its status, source, and stable code already set. The catalogue of these lives in core errors-and-exceptions.
  • No code, just a reason-phrase title means arm 2 (a Symfony HTTP exception) or arm 3 (Internal Server Error, the generic 500). These are the bundle's status-keyed shapes for failures that originated outside core's vocabulary.

Documenting your own error codes

Core catalogues its own error codes in the generated OpenAPI document. Codes that share a status, a source member and a declared meta are grouped into one shape (Error404, Error400Parameter, …), each code a const branch of that shape's code, and ErrorDocument.errors.items offers the shapes through an anyOf a generated client can dispatch on (see core's error-code catalogue). The bundle's own codes are catalogued beside them: VALIDATION_FAILED on creates, updates, relationship writes, actions that take a document and POST /operations, and the Atomic Operations codes (ATOMIC_HREF_INVALID, ATOMIC_HREF_UNRESOLVABLE, ATOMIC_OPERATION_NOT_EXPOSED, ATOMIC_OPERATIONS_NOT_SUPPORTED, ATOMIC_OPERATIONS_UNAVAILABLE, ATOMIC_TARGET_TYPE_UNKNOWN and ASYNC_WRITE_IN_ATOMIC_OPERATION) on POST /operations alone. Your application's codes join them when you say where they are.

Each of core's codes is offered only on the operations that can raise it, and the bundle tells core what decides that from its own runtime:

  • ACCESS_DENIED appears on an operation a security expression guards, or one declared true, which says something outside the bundle enforces it. That covers the type's own security* declarations, a relation's security(read:, mutate:) on its endpoints and on linkage a create or update sets, the related type's update expression on a member a to-many write takes from another parent and on an attribute flattened onto a related row, the related type's list expression on a to-many's reads, and an action's own security. An access_control rule matching the operation's route adds it too. A rule whose matcher reads more than the path, method and host, such as the client's IP, counts as matching every route.
  • AUTHENTICATION_REQUIRED appears wherever ACCESS_DENIED does, since an expression refusing an anonymous caller answers 401, and on every route whose firewall has an authenticator, because an authenticator refuses bad credentials even on a public route. A firewall whose matcher reads more than the path, method and host counts as matching every route.
  • FULL_REPLACEMENT_PROHIBITED and REMOVAL_PROHIBITED from the data layer appear on an inverse to-many whose owning side has a non-nullable join column and no orphanRemoval, as the Doctrine mapping says.
  • RESOURCE_NOT_FOUND appears on a create whose linkage can name a missing resource: a related type whose provider scopes what the caller sees, one with an id encoder, or one whose identifier isn't a string column.
  • An include that reaches a relation or related type the caller may not read never refuses the request: the relationship renders its links with no data, so it adds neither code.
  • INCLUSION_NOT_ALLOWED and INCLUSION_DEPTH_EXCEEDED follow the root type's allowed and excluded include paths and maximum depth, and the server's max_include_depth.
  • REQUEST_BODY_INVALID_JSON_API appears on every write with schema_validation on, and otherwise on creates and updates, whose attributes, relationships and meta the handler checks are objects. No response is validated, so the RESPONSE_BODY_INVALID_* codes appear nowhere.

A persister of your own, or a route the bundle can't find, offers the codes it might raise, since the bundle can't see what it does.

An error that wants a place in the catalogue implements core's DescribedErrorInterface, which reads the code, status and title off the class — nothing is constructed to describe it:

use haddowg\JsonApi\Exception\AbstractJsonApiException;
use haddowg\JsonApi\Exception\DescribedErrorInterface;
use haddowg\JsonApi\Exception\ErrorDescriptor;

final class PaymentRequired extends AbstractJsonApiException implements DescribedErrorInterface
{
    public function __construct()
    {
        parent::__construct('This operation requires an active subscription.', self::describe()->status);
    }

    public static function describe(): ErrorDescriptor
    {
        return new ErrorDescriptor(code: 'PAYMENT_REQUIRED', status: 402, title: 'Payment required');
    }

    public function getErrors(): array
    {
        return [self::describe()->toError(detail: $this->getMessage())];
    }
}

Point the bundle at the directory it lives in:

# config/packages/json_api.yaml
json_api:
    error_codes:
        paths:
            - '%kernel.project_dir%/src/Exception'

Each listed directory is walked at container build time, so a request never touches the filesystem, and the compiled container is rebuilt when a file under one of them changes. Nothing outside these paths is scanned and the default is none: an exception reaches your published contract only because you named the directory it sits in. That scoping is the point — a described error left in a test fixture or a scratch namespace would otherwise become part of the API's contract by accident.

For a class no scan reaches — one in a vendored package, one generated into a cache directory — register a source naming it. Core's ClassListErrorSource is the escape hatch, and autoconfiguration tags any ErrorCatalogSourceInterface service (haddowg.json_api.error_source), so there is nothing else to wire:

services:
    app.jsonapi.error_source:
        class: haddowg\JsonApi\Exception\ClassListErrorSource
        arguments:
            - 'Acme\Billing\Exception\CardDeclined'
            - 'Acme\Billing\Exception\ChargebackFiled'

Write your own ErrorCatalogSourceInterface when the class list is computed rather than written down; it yields class-strings, never descriptors.

Two codes claiming the same code string is a container-build failure, not a last-one-wins merge: a code is what a client dispatches on, so publishing one class's status and title under another's would be a lie. The catalogue stays open either way — the anyOf leads with the generic Error, so an error carrying a code you never declared is still a valid error object.

Contributed codes are documented on every server this bundle declares. An exception class is not server-scoped the way a resource is, so there is no per-server registration to get wrong.

Scoping a code to the operations that raise it

A contributed code is offered by every operation's error response for its status. When only some operations raise it, say so on the error itself: give its descriptor a scope.

use haddowg\JsonApi\Exception\ErrorDescriptor;
use haddowg\JsonApi\Exception\ErrorScope;

public static function describe(): ErrorDescriptor
{
    return new ErrorDescriptor(
        code: 'ALBUM_LOCKED',
        status: 409,
        title: 'Album locked',
        scope: ErrorScope::on('albums', 'update', 'delete'),
    );
}

ErrorScope::on() names operations of one type the way operationExamples keys them (update, fetchRelated.artist, action.purchase.post), or every operation of the type when it names none; ErrorScope::kinds() covers operations of a kind on every type, and and() combines scopes. A class found under error_codes.paths keeps its descriptor's scope, so a scoped error can live in the scanned directory beside the rest.

Only the covered operations then offer the code. Each gets its own error document for the code's status, named for the operation, such as AlbumsUpdate409, and an inline response that uses it, gaining that status if it didn't advertise it. Every other operation keeps the shared response, unless one of core's own feature codes, such as CURSOR_MALFORMED on a cursor-paged read, already gives it a document of its own for that status. See core's scoping a code to the operations that raise it.

For an error you don't own, such as one a package ships with no scope, register core's ScopedErrorSource instead. It catalogues the classes it names under its own scope, in place of whatever their descriptors declare, and autoconfiguration tags it like any other source. Its scope is a value object built by a named constructor, so in config/services.php it is an inline service with a factory:

// config/services.php
use Acme\Billing\Exception\PaymentRequired;
use haddowg\JsonApi\Exception\ErrorScope;
use haddowg\JsonApi\Exception\ScopedErrorSource;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

use function Symfony\Component\DependencyInjection\Loader\Configurator\inline_service;

return static function (ContainerConfigurator $container): void {
    $services = $container->services()->defaults()->autowire()->autoconfigure();

    $services->set('app.jsonapi.payment_errors', ScopedErrorSource::class)
        ->args([
            inline_service(ErrorScope::class)
                ->factory([ErrorScope::class, 'on'])
                ->args(['albums', 'action.purchase.post']),
            PaymentRequired::class,
        ]);
};

The same in YAML:

services:
    app.jsonapi.payment_errors:
        class: haddowg\JsonApi\Exception\ScopedErrorSource
        arguments:
            - !service
                class: haddowg\JsonApi\Exception\ErrorScope
                factory: ['haddowg\JsonApi\Exception\ErrorScope', 'on']
                arguments: ['albums', 'action.purchase.post']
            - 'Acme\Billing\Exception\PaymentRequired'

A name that isn't an operation name throws when the scope is built (for a ScopedErrorSource service, when the document is first projected), and a scope naming a type the server doesn't register covers nothing on it.

Localizing and overriding error copy

Every error's title and detail are message templates core resolves per stable error code (see localizing and overriding error copy in the core docs). The bundle binds that seam to the Symfony translator automatically: when symfony/translation is installed, any error's copy can be localized or rebranded through ordinary translation files in the jsonapi_errors domain, keyed by code:

# translations/jsonapi_errors.fr.yaml
RESOURCE_NOT_FOUND:
    title: Ressource introuvable
MEDIA_TYPE_UNSUPPORTED:
    detail: "Le type de média '{mediaType}' n'est pas supporté."
VALIDATION_FAILED:
    title: Entité non traitable

Only the human copy moves: an error's code and status are never touched, and a key you don't provide falls back to core's inline English — per slot, so a partial translation is fine. The values are templates: a {placeholder} is filled from the error's context after translation (a media type, an id), so write {mediaType}, not Symfony's %mediaType% (no parameters are passed to the translator). The placeholder names available per code are listed in core's errors-and-exceptions.

The lookup uses the translator's current locale, so Accept-Language negotiation is the framework's job — wire Symfony's usual locale resolution and each request renders in its negotiated language. Because the resolver is applied uniformly to every error, the validator's 422 VALIDATION_FAILED title (arm 1) localizes through the very same domain. Without symfony/translation the seam is inert and errors render in English exactly as before.

Date messages

A value that is not the date it should be, whether a temporal attribute on a write or a date filter's bound or value, has one message per kind of date, such as This value is not a date like 2026-10-01. Its source says which value it was. Each kind has its own key below the error's code, nested beside the code's detail, and its {example} placeholder holds the field's or filter's declared example, or a fixed one:

# translations/jsonapi_errors.fr.yaml
ATTRIBUTE_VALUE_INVALID:
    date_time:
        detail: "Cette valeur n'est pas une date-heure RFC 3339 avec décalage, comme {example}."
    date:
        detail: "Cette valeur n'est pas une date comme {example}."
    time:
        detail: "Cette valeur n'est pas une heure comme {example}."
    formatted_date_time:
        detail: "Cette valeur n'est pas une date-heure comme {example}."
FILTER_VALUE_INVALID:
    date:
        detail: "Cette valeur n'est pas une date comme {example}."

A missing kind falls back to the code's own detail and then to the English default, so an existing ATTRIBUTE_VALUE_INVALID.detail translation still applies. A date in a write's typed meta is a VALIDATION_FAILED error and still uses the ATTRIBUTE_VALUE_INVALID keys.

Next / see also

  • lifecycle — the success path this listener mirrors: kernel.request → JsonApiController → kernel.view, and where negotiation raises the 415/406/400 errors this listener then renders.
  • routing — where the _jsonapi route marker (and _jsonapi_server) are stamped, and why an unknown type 404s at the router before this listener.
  • validation — how a write failure becomes the 422 VALIDATION_FAILED document arm 1 renders.
  • multi-server-and-testing — how _jsonapi_server resolves to the per-server Server the error document is rendered against.
  • Core errors-and-exceptions (the exception catalogue, Error/ErrorSource, ErrorResponse, InternalServerError::for, and JsonApiExceptionInterface).