Skip to content

Invalid raw-binary load choices are reported as unsupported or missing targets #2002

Closed

Description

@kaoru0822-kitauji

Observed behavior

Headerless load choices that the caller supplies (target_format/--target-format, architecture, entry_point) are reported as problems with the target file, with advice that does not fix them. On main e19879328, using any 64-byte file:

Invocation Projected error
rea analyze f.bin --target-format raw-binary --architecture arm --entry-point 0x1 target_unavailable / unsupported_target: "Cannot open artifact: raw-binary arm entry_point 0x1 must be 4-byte aligned.", remediation "Review the reported file-format reason and select a supported, well-formed target."
same with --architecture x86 --entry-point 0xffffffffff same code and category, "must fit in the x86 address width", same remediation
rea analyze f.bin --architecture arm --entry-point 0x0 (no --target-format) target_unavailable / unavailable: "architecture and entry_point apply only with format=raw-binary. Check that the path exists, is readable, and points to a supported file."

The file is readable, and any bytes are a valid raw binary; only the caller's arguments need correcting. BinaryTargetResolver labels every admitRawBinary rejection file_format_rejected (from the #1979 fix), and the format-pairing rejection has no constraint at all. Codex raised this on #1987 ("Separate raw-binary input errors from format rejection").

Expected behavior

Rejected headerless load selections project as caller input (invalid_request / invalid_input), with the reason as the message and a remediation that names the raw-binary arguments. An empty file (raw-binary requires at least one file byte) remains a target refusal.

Activity

  1. added
    bug
    on Oct 12, 2026
  2. jimpablo commented on Oct 12, 2026

    @jimpablo
    Contributor

    I'd like to work on this.

    The misclassification has two producers in src/application/BinaryTargetResolver.ts:

    1. Every admitRawBinary rejection is wrapped with constraint: "file_format_rejected" (the formatHint === "raw-binary" branch), so caller-input problems — missing architecture, malformed entry_point, misalignment, address-width overflow — project as unsupported_target / target_unavailable with "review the file" remediation. Of those rejections, only the empty-file extent ("raw-binary requires at least one file byte") is actually a property of the target.
    2. The pairing rejection ("architecture and entry_point apply only with format=raw-binary") carries no constraint at all, so it falls to the default BinaryTargetError projection: unavailable / target_unavailable plus "Check that the path exists…". The MCP contract layer already rejects this pairing as input (sessionLifecycleInputs superRefine via rawBinarySelectionError); the resolver duplicates that message without the classification.

    Planned change:

    • src/domain/rawBinary.ts: admitRawBinary rejections become structured — reason plus the owning classification. Caller-input rejections get a new raw_binary_load_rejected constraint; the empty-file extent keeps file_format_rejected.
    • BinaryTargetResolver: raw-binary load rejections — including the format/target-kind pairing and the architecture/entry pairing (reusing rawBinarySelectionError as the single message owner) — carry raw_binary_load_rejected.
    • Projection (analysisErrorPresentation / analysisErrorProjection): raw_binary_load_rejected maps to category invalid_input, code invalid_request, with remediation naming the raw-binary arguments (target_format, architecture, entry_point) and no path-checking advice.
    • Boundary tests over the public projection for the misaligned arm entry, the x86 address-width overflow, the pairing-without-format case, and the empty file (which stays a target refusal), plus real rea analyze runs before/after on a 64-byte fixture.
  3. added
    area: native
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: nativebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions