Skip to content
RasaGet a free license
Menu
Guides for AI teams

Guide · AI product engineer

Why did a Python banking client lose an unknown API status?

Trace an unknown API status through a real schema check and an unchanged banking client to see why the account lookup returns no records.

by Rod Rivera

About 5 minutes to read

Key takeaways (3)
  • Check what the caller returns after validation fails.
  • Require evidence for an empty result, including the status code that permits it.
  • Test unknown replies beside the documented exceptions.

An account lookup returned an empty list after its validator rejected the reply. The reply was authored for an offline probe. The client and its pinned vendor schema were real and unchanged.

These selected fields from the recorded probe output show the input and the caller’s result:

{
  "authoredReply": {
    "Status": {
      "StatusCode": 777777,
      "Severity": "Warning"
    }
  },
  "realPinnedSchema": "rejected",
  "actualPartyAccountsResult": []
}

The validator caught an invalid body. The code after it turned that uncertainty into “no accounts.” An integration receiving this list cannot distinguish that case from an ordinary empty lookup.

Authored HTTP 200 reply with code 777777 and Warning severity is rejected by the real pinned Premier schema, then the unchanged lookup returns an empty list. The same code with Error severity stays unavailable. The reply is an authored probe input.

Not claimed: Trained agent, model, voice, vendor, or current global release acceptance.

Four rejected replies, two caller outcomes

The probe exercises the Premier example in Rasa Community Resources. It substitutes four authored replies with Hypertext Transfer Protocol (HTTP) status 200. It keeps the original request, header, and response validation, then calls the original account-lookup method.

Authored status-only bodyReal pinned schemaActual account-lookup result
Code 1120, severity InfoRejectedEmpty list []
No code, severity InfoRejectedEmpty list []
Code 777777, severity WarningRejectedEmpty list []
Code 777777, severity ErrorRejectedUnavailable: invalid_response

All four rows come from the retained output. The last two differ only in severity. Changing Warning to Error preserves an unavailable result. Removing the code altogether still produces an empty list.

The arbitrary code is a test input, with no claimed vendor meaning. No Fiserv service sent these replies during the probe. They test whether the client requires evidence that a rejected reply means no records.

Follow the rejection into the empty list

The client source validates the reply before inspecting it. On validation failure, reads can reach this condition:

            if (isinstance(data, dict) and set(data) == {"Status"} and isinstance(data["Status"], dict)
                    and data["Status"].get("Severity") in {"Info", "Warning"}):
                raise NoRecords("no_records") from None
            raise Unavailable("invalid_response") from None

The condition requires one top-level key, a status object, and an accepted severity. It never reads the status code. The nearby comment describes a trial reply with code 1120 and severity Info. The condition accepts more than that description: other codes, missing codes, and Warning severity all qualify.

The original trial’s raw log is missing. Only the source comment remains from that trial. The probe independently establishes how the current client handles these authored bodies.

The second conversion occurs in the account-lookup caller:

        except NoRecords:
            return []

A named exception might look like a precise domain decision. Here, it carries a broad shape-and-severity test into an ordinary collection. By the time the caller returns, the reason validation failed has disappeared.

A test that only asserts schema rejection would pass for every row in the table. To expose the loss, assert on the account method’s return value or exception as well.

The validation error is caught twice

The first catch changes the meaning of a schema failure. The account caller then turns that named exception into an ordinary collection. The write branch exits with an unknown outcome before reaching this fallback.

FigureThe validation error is caught twice

Require evidence before returning no records

Keep the vendor schema intact. Whitelist documented no-records cases in the client, and keep unknown replies unavailable. This costs more operator follow-up when a new or malformed status arrives. It also preserves the difference between “nothing matched” and “we could not interpret the reply.”

For this client, the replacement condition should name the operation, allowed status code, severity, and body shape. Each allowed combination needs release-specific evidence. A whitelist needs independently sourced code meanings; this guide leaves that change as a proposal.

Use the table as a regression boundary. A missing code must remain unavailable. An arbitrary code must remain unavailable even with Info or Warning severity. A documented no-records case may return an empty list only after its permitted fields and values have been established. Run those assertions through the public account method, alongside the validator checks.

The same review applies wherever an adapter catches a parse or validation error and returns an ordinary value. Find the catch, then ask what evidence permits that value. A default empty collection can erase a failure as thoroughly as a default zero.

Replay the counterexample with the pinned contract

The definition release is legacy Premier 11.0.0_PRM, rather than generic v11. The contract loader checks the archive hash and five selected member hashes before constructing its validators.

The recorded archive is BankingHub_Premier_api_specs.zip, with SHA-256:

65404b27b99d12bedc5cddf5d714dc6117d2d4fb3896e7d18d3067e324f4f7a8

The downloadable probe asserts all four schema rejections, all three empty lists, the Error control, and one substituted send per case.

Show the reproduction command

Use the example at the recorded revision, and follow its README to supply the exact vendor archive. Save it in the example’s vendor-inputs directory. The archive is not redistributed with this article.

Download the probe script. From the example directory, with its locked dependencies installed, run:

contract_probe_dir=$(mktemp -d "$PWD/contract-probe.XXXXXX")
curl --fail --location https://rasa.community/receipts/api-reply-classification/real-contract-probe.py -o "$contract_probe_dir/real-contract-probe.py"
uv run --locked python -I "$contract_probe_dir/real-contract-probe.py"

Compare the printed rows with the retained complete output. This reader invocation uses an isolated interpreter and a fresh download directory; the retained original run predates this invocation. The script imports the original client and actual contract. It overrides only the send method to return each authored HTTP 200 reply. It opens no socket and contacts no vendor, model, or bank.

If the archive is absent, the helper raises a skipped-input exception. That is not a successful reproduction. A different archive fails the loader’s hash check.

The separate component proof records the baseline suite on Rasa Pro 3.21.0.dev5, with the installed wheel verified. Its retained output ends:

Ran 79 tests in 28.572s

OK

There were no skips in that baseline. Its archive-dependent wrong-shapes test checks a different body, with Status missing. The four status-only cases above come from the separate probe, not from that existing test.

Start with the empty-result catch in your own adapter and add a missing-code case through its real validator.