Freelance fullstack developer creating fast, modern, and refined applications. I focus on simplicity, performance, and real value for users. I also write tech-related articles here.
Great breakdown of the gap between runtime error identity and persisted trace fidelity. It is surprisingly easy for an instrumentation wrapper to pass behavioral retry tests on error.code while silently dropping that exact field during serialization, which usually only surfaces later when offline reports lump real timeouts into "unknown" or push teams into parsing brittle error messages.
The point about avoiding a naive full-object dump and verifying an explicit allowlist with a negative fixture for sensitive fields is especially practical. Separating those two contracts upfront saves a lot of silent observability debt.
Staff Software Engineer @ Navan, ML Flow & Cypress Ambassador, Docker Captain and creator of agent-inspect, writing about production AI agents, TypeScript, observability, testing, and developer tools.
Thanks, @johnnylemonny. That is exactly the failure mode: a retry test can pass while the readback contract quietly fails. I like pairing the known-code assertion with a synthetic sensitive field that must not survive serialization; it makes both fidelity and the privacy boundary testable. Have you run into an SDK error where a bounded field other than code was essential for diagnosis?
Freelance fullstack developer creating fast, modern, and refined applications. I focus on simplicity, performance, and real value for users. I also write tech-related articles here.
Definitely. HTTP status codes and provider-specific request IDs (like statusCode or requestId in AWS or OpenAI SDK errors) are essential when code alone is too broad, such as distinguishing a transient 429 rate limit from a hard 403 or tracing a specific failure with support. Keeping a bounded allowlist for fields like status, retryable, and requestId gives you actionable diagnostics without risking payload or header leaks.
Staff Software Engineer @ Navan, ML Flow & Cypress Ambassador, Docker Captain and creator of agent-inspect, writing about production AI agents, TypeScript, observability, testing, and developer tools.
@johnnylemonny That is a useful distinction: a bounded status or retryable flag can help classify a 429, while a request ID is mainly for correlation with provider support. I would keep those fields on an explicit allowlist, cap their length, and assert both what survives and what is excluded after persisted readback. Thanks for the concrete examples.
The ETIMEDOUT example makes this concrete. The retry policy can pass in the app while the persisted trace quietly loses the code it needs, so the allowlist plus negative fixture approach feels like the right call.
Staff Software Engineer @ Navan, ML Flow & Cypress Ambassador, Docker Captain and creator of agent-inspect, writing about production AI agents, TypeScript, observability, testing, and developer tools.
@robertpaschal Exactly. I would make the negative fixture as explicit as the known-code assertion: attach a fake sensitive header to the synthetic error, then verify the persisted trace omits it. Otherwise a fidelity fix can quietly expand what traces retain.
Error preservation needs a contract test at every boundary, including serialization and storage. I would assert the stable machine fields separately from display text, then run the same fixture through the logger, queue, and trace exporter. That catches the cases where a stack remains visible but the code used for routing disappears.
I measure AI coding claims in public. LGTM β Let's Get the Measurements: real runs, real numbers, receipts. Every article is an experiment I actually ran. Books & packs: aheadkit.gumroad.com
The table is the whole piece for me β both paths rethrow the same object, but the manual path drops error.code while keeping the message, which is backwards, since the message is the unstable part. And the two paths don't even agree on schema version, 0.1 against 1.0. Do traces from both paths ever land in the same report, and if they do, how do you stop the 0.1 rows from silently classifying every timeout as unknown?
Staff Software Engineer @ Navan, ML Flow & Cypress Ambassador, Docker Captain and creator of agent-inspect, writing about production AI agents, TypeScript, observability, testing, and developer tools.
@aheadkit I would treat schema 0.1 as lacking that field by contract and classify it as unavailable, rather than as a genuine unknown error code. If both paths feed one report, keep schema version on every row, split counts by capture path, and never infer error.code from message text. The mismatch remains a compatibility gap to fix, not something reporting should hide.
Senior Software Engineer focused on backend, databases, infrastructure, and AI coding agents. Sharing real systems, practical fixes, and reproducible results.
Location
Indonesia
Education
Mikroskil University: B.Sc. Information Systems, 2014
In agentdiet 0.11, 94 % of CI integrations consume --json rather than text, so the CLI's output contract β including error codes β is part of the agent's effective capability, not just the model. A missing error.code in the trace means 94 % of automated consumers lose the classification they rely on for retry policies and alerting.
Staff Software Engineer @ Navan, ML Flow & Cypress Ambassador, Docker Captain and creator of agent-inspect, writing about production AI agents, TypeScript, observability, testing, and developer tools.
That JSON consumer angle is useful, @prascli. A CLI schema can become an operational dependency even when the human-readable output looks fine. I would test the installed CLI end to end with a known error code, then fail CI if its JSON readback drops or renames the field. In agentdiet, do those consumers mainly use codes for retry decisions, alert grouping, or both?
An independent editorial space exploring software engineering, engineering governance, and AI-assisted development.
We observe. We interpret. We reframe.
When the margins push engineering forward.
The distinction between runtime error preservation and persisted evidence fidelity is important. One additional concern is schema compatibility. If different instrumentation paths persist different schema versions and diagnostic fields, downstream consumers may need to distinguish between an actual absence of an error code and a field that was never captured.
Would you consider schema-version compatibility and field availability part of the same contract, especially when traces from multiple capture paths feed the same reporting pipeline?
Staff Software Engineer @ Navan, ML Flow & Cypress Ambassador, Docker Captain and creator of agent-inspect, writing about production AI agents, TypeScript, observability, testing, and developer tools.
@code_in-the_margins Yes. Schema version and field availability belong in the readback contract: a missing code on a 0.1 manual row means it was not captured, while a missing code on a 1.0 row may mean the error had no code. A mixed report should preserve that distinction explicitly; otherwise it turns a serialization gap into a misleading error category.
We're a place where coders share, stay up-to-date and grow their careers.
Great breakdown of the gap between runtime error identity and persisted trace fidelity. It is surprisingly easy for an instrumentation wrapper to pass behavioral retry tests on
error.codewhile silently dropping that exact field during serialization, which usually only surfaces later when offline reports lump real timeouts into "unknown" or push teams into parsing brittle error messages.The point about avoiding a naive full-object dump and verifying an explicit allowlist with a negative fixture for sensitive fields is especially practical. Separating those two contracts upfront saves a lot of silent observability debt.
Thanks, @johnnylemonny. That is exactly the failure mode: a retry test can pass while the readback contract quietly fails. I like pairing the known-code assertion with a synthetic sensitive field that must not survive serialization; it makes both fidelity and the privacy boundary testable. Have you run into an SDK error where a bounded field other than
codewas essential for diagnosis?Definitely. HTTP status codes and provider-specific request IDs (like
statusCodeorrequestIdin AWS or OpenAI SDK errors) are essential whencodealone is too broad, such as distinguishing a transient 429 rate limit from a hard 403 or tracing a specific failure with support. Keeping a bounded allowlist for fields likestatus,retryable, andrequestIdgives you actionable diagnostics without risking payload or header leaks.@johnnylemonny That is a useful distinction: a bounded status or retryable flag can help classify a 429, while a request ID is mainly for correlation with provider support. I would keep those fields on an explicit allowlist, cap their length, and assert both what survives and what is excluded after persisted readback. Thanks for the concrete examples.
The ETIMEDOUT example makes this concrete. The retry policy can pass in the app while the persisted trace quietly loses the code it needs, so the allowlist plus negative fixture approach feels like the right call.
@robertpaschal Exactly. I would make the negative fixture as explicit as the known-code assertion: attach a fake sensitive header to the synthetic error, then verify the persisted trace omits it. Otherwise a fidelity fix can quietly expand what traces retain.
That fixture is the test. If the trace still carries the header, the fix made things worse.
Error preservation needs a contract test at every boundary, including serialization and storage. I would assert the stable machine fields separately from display text, then run the same fixture through the logger, queue, and trace exporter. That catches the cases where a stack remains visible but the code used for routing disappears.
The table is the whole piece for me β both paths rethrow the same object, but the manual path drops error.code while keeping the message, which is backwards, since the message is the unstable part. And the two paths don't even agree on schema version, 0.1 against 1.0. Do traces from both paths ever land in the same report, and if they do, how do you stop the 0.1 rows from silently classifying every timeout as unknown?
@aheadkit I would treat schema 0.1 as lacking that field by contract and classify it as unavailable, rather than as a genuine unknown error code. If both paths feed one report, keep schema version on every row, split counts by capture path, and never infer
error.codefrom message text. The mismatch remains a compatibility gap to fix, not something reporting should hide.In agentdiet 0.11, 94 % of CI integrations consume
--jsonrather than text, so the CLI's output contract β including error codes β is part of the agent's effective capability, not just the model. A missingerror.codein the trace means 94 % of automated consumers lose the classification they rely on for retry policies and alerting.That JSON consumer angle is useful, @prascli. A CLI schema can become an operational dependency even when the human-readable output looks fine. I would test the installed CLI end to end with a known error code, then fail CI if its JSON readback drops or renames the field. In agentdiet, do those consumers mainly use codes for retry decisions, alert grouping, or both?
The distinction between runtime error preservation and persisted evidence fidelity is important. One additional concern is schema compatibility. If different instrumentation paths persist different schema versions and diagnostic fields, downstream consumers may need to distinguish between an actual absence of an error code and a field that was never captured.
Would you consider schema-version compatibility and field availability part of the same contract, especially when traces from multiple capture paths feed the same reporting pipeline?
@code_in-the_margins Yes. Schema version and field availability belong in the readback contract: a missing code on a 0.1 manual row means it was not captured, while a missing code on a 1.0 row may mean the error had no code. A mixed report should preserve that distinction explicitly; otherwise it turns a serialization gap into a misleading error category.