Scenario
Which side failed, the engine or the input
RolesAgent Systems EngineeringAI Evaluation and Reliability
- Engine
- rea 6.7.0 at 27dc42d with the Ghidra provider
- Model
- no model; the fixtures are the ledger binaries built at -O1 and -O2
- Hardware
- one aarch64 Mac
Situation
A team wraps rea in an agent pipeline that analyses binaries overnight. The wrapper has one rule for failures: on any failed call, close the target, stop the Java process, open the target again, and retry. The night log shows the engine restarted eleven times, each restart followed by the same failure, and the import of the target paid for again each time. Two failures appear in the log, and the wrapper treated them the same way.
The first came from the command line on the Mac that runs the pipeline: a layout inspection of an object file exited 1. The second came from the MCP session: analyze_function returned an error for a procedure name that the agent had typed. You have the command record, the two error envelopes, the session index and the server log. Say what each failure was, and write the retry rule that the wrapper should have had.
Questions
- Both envelopes have the same five fields. Which two fields decide what to do next, before you read the message?
- The first failure says that a profile supports Linux x64 only. What was wrong, the host, the file, or the engine, and what is the right next call?
- The second failure is
retryable: true. What would a retry with the same arguments return, and what has to change? - How does the diagnostics object tell you that the Ghidra process was healthy when the call failed?
- Name the codes for which a restart of the engine is the correct response.
Commit to a cause after each listing. Write it down before you read the next one.
Evidence
the CLI call that exited 1
The command, its exit code, its time, and the file it wrote.
$ rea inspect-binary-layout fixtures/ledger-x86_64-O1.o --format json
[exit 1] (0.6 s) -> 04-inspect-binary-layout.jsonSource: manuals/reverse-engineering-101/capture/out/00-commands.txt, lines 10-11
the whole envelope of that call
Read code, category and retryable before the message.
{
"code": "capability_unavailable",
"category": "unsupported_provider",
"message": "The initial real-verified pwntools artifact profile supports Linux x64 only.",
"retryable": false,
"remediation": {
"action": "The initial real-verified pwntools artifact profile supports Linux x64 only."
},
"details": {
"provider_id": "pwntools-elf",
"operation": "inspect_binary_layout",
"reason": "The initial real-verified pwntools artifact profile supports Linux x64 only."
}
}Source: manuals/reverse-engineering-101/capture/out/04-inspect-binary-layout.json
three consecutive calls of the MCP session
The call before and the call after the error both succeeded on the same open target.
12 tools/call analyze_function ok -> 10-mcp-12-analyze-function-grade-label-O1.json (18 ms)
13 tools/call analyze_function error -> 10-mcp-13-analyze-function-missing.json (4 ms)
14 tools/call export_evidence_bundle ok -> 10-mcp-14-export-evidence-bundle-O1.json (18 ms)Source: manuals/reverse-engineering-101/capture/out/10-mcp-session.txt, lines 12-14
the decoded error of the MCP call
Read code, category and retryable, then the one issue in details.
"decoded_text": {
"error": {
"code": "invalid_request",
"category": "invalid_input",
"message": "Analysis input is invalid. Check the arguments and try again.",
"retryable": true,
"remediation": {
"action": "Correct the listed arguments and retry."
},
"details": {
"operation": "analyze_function",
"issues": [
{
"path": [],
"reason": "invalid_value",
"message": "Unknown Ghidra procedure name or address: _nothing"
}
],Source: manuals/reverse-engineering-101/capture/out/10-mcp-13-analyze-function-missing.json, lines 32-49
the end of the diagnostics object
The engine wrote nothing to stdout or stderr, the capture is complete, and the remote code is not_found.
"failure_output": {
"stdout": {
"text": "",
"bytes": 0,
"retained_bytes": 0
},
"stderr": {
"text": "",
"bytes": 0,
"retained_bytes": 0
},
"complete": true
},
"failure_cause": {
"name": "GhidraRemoteError",
"message": "Unknown Ghidra procedure name or address: _nothing",
"code": "not_found"
},
"failure_kind": "remote",
"failure_message": "Unknown Ghidra procedure name or address: _nothing",
"remote_code": "not_found",
"remote_message": "Unknown Ghidra procedure name or address: _nothing"Source: manuals/reverse-engineering-101/capture/out/10-mcp-13-analyze-function-missing.json, lines 92-113
the server log around the failed call
Two error lines at level 40, one per layer, then the next call completes with status ok.
{"level":40,"time":1792316959970,"application":"rea","mode":"mcp","layer":"ghidra-bridge","method":"analyze_function","status":"error","msg":"Ghidra bridge request completed"}
{"level":40,"time":1792316959971,"application":"rea","mode":"mcp","layer":"server","tool":"analyze_function","durationMs":2.73,"status":"error","msg":"MCP tool execution completed"}
{"level":30,"time":1792316960484,"application":"rea","mode":"mcp","layer":"server","tool":"close_binary","durationMs":491.18,"status":"ok","msg":"MCP tool execution completed"}Source: manuals/reverse-engineering-101/capture/out/10-mcp-server.log, lines 10-12
The answer
Show the walkthrough
- Read code, category and retryable first. Every rea error carries
code,category,message,retryableandremediation. The code is the discriminator, one of twenty. The category is one of ten and names the kind of problem. The flag says whether the same call can succeed later. The message is for a person. A wrapper branches on the first two fields and the flag, never on the message text. - Read the CLI failure. The command record shows
inspect-binary-layouton the object file, exit 1 after 0.6 s. The envelope has codecapability_unavailable, categoryunsupported_provider, andretryable: false. The details name the providerpwntools-elfand the operation. That provider runs on one platform, Linux x64, and the pipeline runs on a Mac. The engine never ran. The right next call is another provider or another host, and the manual usesinspect-machoas the layout tool on this machine. No restart can change a provider that does not run here. - Read the MCP failure. The session index shows the call before and the call after both completed on the same open target, and the failed call took 4 ms. The decoded error has code
invalid_request, categoryinvalid_input, andretryable: true. The one issue in the details says that the procedure name is unknown. The flag means that a corrected call can succeed on the same connection. A retry with the same name returns the same error, so the argument has to change, andlist_proceduresgives the names that exist. - Read the diagnostics.
failure_outputholds the stdout and stderr that Ghidra wrote during the failed request: both empty, withcomplete: true. The remote code isnot_found. An empty, complete output with a remote code says that the engine answered the question and the answer was no. The server log agrees: two lines at level 40, one for the bridge layer and one for the server layer, with a duration of 2.73 ms, and the next line isclose_binarywith statusok. The engine was healthy before, during and after. - Place the restart. A restart answers a different family of codes:
provider_unavailable,provider_timeout, and anexecution_failurewhose diagnostics show incomplete output. The manual namesprovider_timeoutas the code of a first Ghidra-backed call that passes the startup deadline of 330,000 ms, andtarget_unavailableas the code of every provider tool beforeopen_binary. Neither appeared in these two failures.
Show the resolution
Neither failure was the engine's. The first was a provider that does not run on the host, not retryable, fixed by a different tool. The second was a wrong argument, retryable after the argument changes, and the Ghidra process stayed up and served the next call in the same session. The eleven restarts bought nothing and cost an import each.
The wrapper now reads category and retryable before anything else. unsupported_provider and unsupported_target route to a different provider or host and stop. invalid_input corrects the argument from a listing and retries once. unavailable, timeout and an execution_failure with incomplete output restart the engine, with a bound on the count. Everything else is reported to a person with the message and the remediation. After the change, the next night ran with no restart, and the two failures became one line each in the report.
Show the wrong turns
“Exit 1 means the engine crashed; restart it.”
The envelope says
unsupported_provider, not retryable. The provider never started, and a restart starts nothing new.“retryable is true, so retry the same call.”
The flag says that the call can succeed later, after the input changes. The same unknown name gets the same answer.
“Match the message text to decide the branch.”
Messages are written for people and can change between releases. The code, the category and the flag are the contract.
“Any level 40 line in the server log means the bridge is unhealthy.”
Both lines record one failed request that completed in 2.73 ms, and the next line records a successful call on the same connection.
Show the general rule
An error envelope is a typed answer, and a retry policy that ignores its type turns every failure into the most expensive one. Read the discriminator and the retryable flag, keep a table from category to action, and look at the diagnostics for proof that the engine was alive before you restart it. The cheapest fix for most failures is a changed input, and the most expensive is a cold start, so the policy must tell them apart.
Taught in
The errors reference of Reverse Engineering 101 lists the five fields and the twenty codes, the dossier page reads the unknown-name error and its log lines, the MCP server page gives the startup deadline and the recovery that a timeout deserves, and the failure modes lesson names cascading errors as the mode where one wrong response triggers more calls.