* fix(native): report non-native bytes as unrecognized, not malformed
A file that is not the format a reader owns was reported as a broken file
of that format. `inspect_native_initializers` called a PE file or random
bytes a malformed target, and the thin Mach-O reader called any bytes
without Mach-O magic a malformed Mach-O.
Format owners can now say "these bytes are not my format": parse failures
and format target failures gain the `unrecognized` kind that target
failures already define ("no reader for this operation recognizes the
bytes"). The owners report it once:
- the thin Mach-O reader, for bytes without Mach-O magic;
- the shared native container reader, for bytes that are not ELF, PE or
Mach-O (previously `unsupported`);
- the initializers provider, for a file with neither ELF nor Mach-O magic.
Function starts no longer pre-checks the header itself; the shared reader
owns that decision. IL2CPP keeps mapping unknown native bytes to its
unsupported-container reason. A recognized header that is cut off or
broken stays truncated or malformed.
* fix(resources): keep every format failure kind's facts through artifact wrappers
`ArtifactReaderFailure` kept the owner's facts only for its own list of
three format kinds, and `artifactOperationReason` had a second list. With
`unrecognized` added, `artifactFormatFailure` and `artifactParseFailure`
dropped its facts, so `translateArtifactFailure` raised an internal
invariant error instead of the target failure.
The format kinds are now one list, `FORMAT_TARGET_FAILURE_KINDS`, and
`isFormatTargetFailureKind` is the one guard. `FormatTargetFailure`,
`ParseFailureKind` and `BinaryFormatFailure` derive from that list, and
the reader-failure constructor and the operation-reason check both use the
guard, so a new kind cannot be carried by one wrapper and dropped by another.
* test(conformance): expect unrecognized for foreign bytes on native readers
The Go, Rust and native-initializers readers now report bytes that are not
ELF, PE or Mach-O as unrecognized, so their foreign-bytes conformance cases
expect that kind. The case names follow the kind.
10 KiB
Target failures
When REA cannot read a target, details.failure_kind identifies why. It is the primary machine identifier, in the sense of an RFC 9457 problem type. code is a coarse class derived from it, and retry says whether repeating the request can help. Clients should branch on failure_kind and must not parse message, remediation.action or details.reason.
Kinds
failure_kind |
Meaning | code |
category |
retry |
What to do |
|---|---|---|---|---|---|
selection |
The request names something that is not a valid target for this operation. | invalid_request |
invalid_input |
after_change |
Fix the request. |
unrecognized |
No reader for this operation recognizes the bytes. | unsupported_target |
unsupported_target |
none |
Choose another operation or provider. |
unsupported |
A recognized format, but in a version or variant this reader does not implement. | unsupported_target |
unsupported_target |
none |
Choose another operation or provider. |
malformed |
The bytes break the format's own rules. | unsupported_target |
unsupported_target |
none |
Choose another target, or a well-formed copy. |
truncated |
The bytes end before a structure they declare. | unsupported_target |
unsupported_target |
none |
Re-acquire the complete file. |
integrity |
The bytes contradict a digest or checksum they declare. | target_integrity_mismatch |
integrity_mismatch |
none |
Get a fresh copy, or keep the observed bytes with integrity_policy=record-and-continue where it is offered. |
conflict |
Two or more inputs each parse, but disagree. None is blamed. | input_conflict |
invalid_input |
after_change |
Select inputs that belong together. |
changed |
The file changed while it was read. | artifact_changed |
integrity_mismatch |
backoff |
Retry once it is stable. |
access |
Host permissions denied the read. | access_denied |
unavailable |
after_change |
Grant read access. |
io |
The host could not read the file. | host_io_failed |
execution_failure |
backoff (transient errno) or none |
Retry with backoff for a transient error. Otherwise check the device and file. |
The four target refusals share unsupported_target because the caller cannot use the target as it stands, and each needs a different target or tool. failure_kind says which. No other code covers more than one kind.
The list of kinds can grow. Handle the kinds you know, and treat any other kind by its code.
Inventory operations report a container, member or read range that changed during the read as changed, with details.integrity_check naming the check (container-identity, member-identity, unpacked-entry-identity, read-coverage or traversal-coverage). Every operation that reads a selected artifact follows the same rule. A selected target that no longer matches the one the session opened (integrity_check: admitted-identity) is not changed: it reports artifact_operation_failed with retryable: false, and you reopen the target instead of repeating the request. Any other failed integrity check is likewise not retryable unchanged.
A caller's cancellation (cancelled) and an admission limit (resource_constraint) describe the operation, not the target, so they keep their own error shapes. A result cut short by a delivery or decode limit reports code partial. truncated names only a target whose bytes end early.
Retry
retry |
Meaning |
|---|---|
none |
Repeating the request cannot help. The target itself must change. |
backoff |
The unchanged request may succeed later. Retry with backoff. |
after_change |
Only a changed request, input or host permission can succeed. |
retryable keeps the meaning it has across all REA errors: the unchanged request may succeed. For a target failure, it is true exactly when retry is backoff.
Details
Every target failure reports:
operation: the operation that refused the target.path: the exact file at fault. For a composite request, this is the input whose bytes failed. For a conflict, it is the primary input, andinputslists all of them.failure_kind: the kind.format: the format whose owner established the failure, such aself,machoorpe-cli.reason: the owner's description, for people.offsetandfield: where the failure is, when the owner knows.partial_observation: the file's size and SHA-256, when the operation hashed the file before it refused it.
Some kinds add facts:
truncatedreportsavailable_bytesandrequired_byteswhen the owner measured them.conflictreportsinputs, a list of{ field, path }entries, one for each input that disagrees. The CLI spells eachfieldthe way the command spells its option.
MCP delivery
A target failure is always a tools/call result with isError: true, and its projection is the JSON text block. It is never a JSON-RPC error. A provider that throws a target failure inside a tool handler still produces this result.
Migration
This model replaces details.format_failure with failure_kind. It also changes these codes:
- the
truncatedcode topartial; artifact_operation_failedtotarget_integrity_mismatchorhost_io_failed;invalid_requesttoinput_conflict, for a pair of inputs that disagree.
The remaining operations move to this vocabulary area by area, and each release note lists the operations whose code changes. The plan is tracked in #14239.
Container and inventory readers (ZIP, ASAR, PyInstaller, .NET bundles, Node SEA, Deno and Bun standalones, Godot PCK, UnityFS, wxapkg, FIT, uImage, iNES, Android OTA payloads, ESP images, NTFS $MFT streams, firmware record files and others) now report damaged bytes as malformed or truncated, with the reader's format. Before, they reported artifact_operation_failed with details.reason: "format". Two other things changed:
- The Playwright trace, NTFS journal, release exposure and web capture operations report a damaged selected file as
unsupported_target, notinvalid_request. inspect_sqlite_database,inspect_binary_layout,inspect_recorded_crashandinspect_evm_interfacealso report a damaged selected file asunsupported_target(failure_kind: "malformed", withformatsqlite,elf,elf-coreorevm-bytecode), notinvalid_request.- A short read after REA measured the file is now an integrity failure with
details.integrity_check: "read-coverage"(the file changed during the read), not a format error. - An inventory, inspection or extraction of a container (
inventory_artifact,inspect_artifact,extract_artifactand the bundle readers such asinspect_keyed_archive) reports damaged or unsupported bytes as a target failure of the selectedpath, with top-levelretry, like every other operation.details.reasonis now the owner's description, anddetails.detailis gone. Before, these refusals reporteddetails.reason: "malformed","truncated"or"unsupported"with the description indetails.detail, and nopath. - A file that is not a native image at all is now
unrecognized, notmalformedorunsupported.inspect_native_initializersreports a file with neither ELF nor Mach-O magic, such as a PE file, asunrecognized(format: "native-binary"). Thin Mach-O readers, such asinspect_macho_function_starts, report bytes without Mach-O magic asunrecognized(format: "macho"). The Go and Rust binary readers report bytes that are not ELF, PE or Mach-O asunrecognizedtoo. A recognized header that is cut off or broken staystruncatedormalformed. - Every unsupported or unrecognized target is now a target failure too:
failure_kindisunsupportedorunrecognized, with the owner'sformat, top-levelretry, and a recovery from the table. Where the owner knows which operations read the target, the recovery names them anddetails.related_operationslists them. Producer-written remediation sentences are gone; their guidance is indetails.reason.
Related: settings, limits and recovery for limit failures, and docs/user-visible-errors.csv for every error case and its code.