Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

After years of growth, every service in your company reports errors differently, which makes cross-service incident analysis slow. What error-reporting standard would you set across MVC and WebFlux services, and how would you sustain it?

I would set one response format for every service, RFC 9457 problem details, backed by a company-wide catalogue of error type URIs and stable codes. Client-facing messages are kept apart from internal detail, so stack traces and upstream bodies never leave a service, and every error is logged once with a correlation id and its stable code so incidents can be grouped across services. The standard ships in the shared starter for both MVC and WebFlux so teams get it by default, and the catalogue is reviewed periodically so unused codes are retired.

Background to this question

When every service reports errors in its own way, an incident that crosses five services becomes an archaeology project: one service logs 'ERR-17', another returns a bare 500, a third logs the same exception at four levels, and nobody can count how many customers hit the same failure. The fix is partly technical and mostly organisational, because the hard part is getting hundreds of services to adopt the standard and keep it alive for years. In this answer, we will look at what slows incident analysis today, define the response format and catalogue, separate client messages from internal detail, define the logging contract, ship it through the starter, and keep the catalogue healthy.

1Why Inconsistent Errors Slow Incidents Down

During an incident, engineers ask three questions: what is failing, how often, and where did it start. Answering them across services requires that errors can be found, grouped and followed. With inconsistent reporting, none of that works. Different field names prevent a single log query; free-text messages prevent grouping; missing trace ids prevent following a request from the gateway to the database; and duplicated logging inflates counts so that a minor problem looks like a major one.

So the standard has a concrete goal we can measure: an on-call engineer can run one query that shows, for the last hour, every error by code and service, and can open any single occurrence and follow its trace across hops.

2One Format and a Company-Wide Catalogue

The response format is RFC 9457 problem details, a published standard that both Spring MVC and WebFlux support through ProblemDetail. On top of it we add two company-wide extension fields, code and traceId, and a catalogue: a versioned file, owned by the platform group, listing every error type with its URI, its code, its HTTP status and a description. Types are general where possible, such as RESOURCE_NOT_FOUND, VALIDATION_FAILED and DEPENDENCY_UNAVAILABLE, with domain-specific codes added by teams through a lightweight review.

Extract from an error catalogue
CodeStatusType URI suffixMeaning
VALIDATION_FAILED400/validation-failedrequest fields are invalid; see errors
RESOURCE_NOT_FOUND404/not-foundthe addressed resource does not exist
CONFLICT_VERSION409/version-conflictoptimistic lock failed; reload and retry
DEPENDENCY_UNAVAILABLE503/dependency-unavailablea downstream service failed or timed out
INTERNAL_ERROR500/internalunexpected failure; see logs by traceId
The catalogue is code, reviewed like code; a published page is generated from it.

3Client Messages Versus Internal Detail

An error has two audiences. The client needs to know what happened in terms it can act on: the code, a human-readable title, and for validation, which fields to fix. Engineers need everything else: the exception class, the cause chain, the upstream status and body, the SQL state. Mixing them is how stack traces and internal hostnames end up in public responses, which is both a security problem and a coupling problem.

So the rule is that the response contains only catalogue fields and safe detail, and the log contains the full picture, joined by the trace id. Upstream errors are always translated at the client adapter into our own codes; a service never forwards another service's error body. A support engineer given a traceId from a customer's screenshot can find the full detail in seconds, while the customer never sees it.

4A Logging Contract for Every Error

Every error is logged exactly once, at the service edge, as a structured log event with the same fields everywhere: error.code, http.status, trace_id, span_id, service name and version, request path template (such as /orders/{id}, not the actual id), and for server errors the exception and cause chain. Client errors are logged at warn without stack traces; server errors at error with them. Metrics follow the same shape: a counter of errors tagged by code, status and service.

With this contract, the incident query becomes a group-by on error.code and service, and dashboards can show error rates by code across the whole company. The trace id lets the engineer follow one failing request through every hop, whether the services are MVC or WebFlux.

Step throughOne failure across services, with one trace id
GatewayOrders (MVC)Pricing (WebFlux)Logs
POST /orders, traceparent 4bf9...
GET /prices, same trace
log: DEPENDENCY_UNAVAILABLE, trace 4bf9...
503 problem+json, code DEPENDENCY_UNAVAILABLE
log: DEPENDENCY_UNAVAILABLE (pricing), trace 4bf9...
503 problem+json, same code, traceId

6 messages in order. Play them, or step through them one at a time.

One query on the trace id shows the whole path; the code groups it with similar failures.

5Shipping It in the Shared Starter

Standards that live only in a wiki decay. Ours lives in the company's Spring Boot starter, in two flavours, one for MVC and one for WebFlux, with the same behaviour. Adding the starter gives a service the base exception advice, the global handler for errors outside controllers, the problem details format with code and traceId, the structured logging configuration, the error metrics and the catalogue as a dependency, so codes are constants rather than strings typed by hand.

The starter also ships a test kit: a few contract tests a service can run to check that an unknown exception produces a generic 500 with the right shape, that validation errors have the field list, and that no stack trace appears. New services get all of this on day one; existing services adopt it during normal upgrades, tracked on a dashboard that shows which services emit the standard format.

6Keeping the Catalogue Healthy

A catalogue grows and rots if nobody owns it. Codes get added for one-off cases, duplicates appear, and old codes stay for errors that no longer occur. So the platform group reviews it on a schedule, perhaps each quarter, using the error metrics: codes with zero occurrences for six months are deprecated and later retired; near-duplicates are merged; codes used in many services may be promoted to general types. Changes to the catalogue go through review and a changelog, because clients may switch on codes, and removing a code a client depends on is a breaking change.

7Follow-up questions

What if a team needs an error the catalogue does not have?

They propose a code in a pull request to the catalogue, with the status and a description, and use it immediately in their branch. Review should take a day, not a month, or teams will bypass it. Most needs are covered by the general types with a specific detail message.

How do you get old services to adopt it?

Make it cheap and visible. The starter upgrade brings most of it automatically, a migration guide covers the rest, and a dashboard shows which services emit problem details with codes. Services on critical incident paths are prioritised, and the remaining ones adopt it when they are next upgraded rather than in a big-bang project.

Does the standard apply to messaging and batch jobs too?

The logging contract does: a Kafka consumer or a batch step logs failures with the same code, trace id and structured fields, and dead-letter records carry the code. The response format only applies to HTTP, but using the same codes everywhere is what lets incidents be grouped across all kinds of services.

8Conclusion

In this answer, we designed a company-wide error-reporting standard. Every service returns RFC 9457 problem details with a stable code and trace id from a shared catalogue of error types. Client-facing messages are separated from internal detail, so stack traces and upstream bodies stay in logs. Each error is logged once with a fixed set of structured fields, so incidents can be grouped by code and followed by trace id across MVC and WebFlux services. The standard is delivered through the shared starter with a test kit, adoption is tracked, and the catalogue is reviewed regularly to retire unused codes.

What to say in the interviewAbout 90 seconds aloud

Open with

The goal I would state is that an on-call engineer can see every error across the company grouped by code and service, and follow any single failure through every hop by its trace id.

Then, if they want more

To get there, I would set one response format, RFC 9457 problem details, for both MVC and WebFlux, with two extensions everywhere: a stable error code and the trace id.

Codes come from a company-wide catalogue, a versioned file owned by the platform group with the type URI, code, status and meaning, and teams can add domain codes through a quick review.

Client messages and internal detail are strictly separated: responses only contain catalogue fields and safe detail, never stack traces or upstream bodies, and every downstream error is translated into our own code.

Each error is logged exactly once at the edge as a structured event with the same field names, error code, status, trace id, service and path template, plus matching metrics.

All of this ships in the shared starter, one flavour for each stack, with a small contract test kit, so new services get it by default and adoption of old ones can be tracked on a dashboard. Finally, the catalogue is reviewed every quarter using the metrics, deprecating codes that have not occurred for months and merging duplicates.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "After years of growth, every service in your company reports errors differently, which...": https://scrivio-interview-library.netlify.app/spring-boot/webflux/5798e6e586/