Skip to content

update-bank-transaction fails when lineItems are sent #184

Description

@xobosox

The update-bank-transaction tool fails with a generic "An unexpected error occurred while communicating with Xero" whenever the lineItems parameter is included, regardless of other inputs. Because accountCode lives inside lineItems, this makes it impossible to recategorise existing bank transactions via the MCP server.

Steps to reproduce:

Create or retrieve any AUTHORISED, unreconciled bank transaction via the MCP.
Call update-bank-transaction with a minimal valid payload:

json
{
  "bankTransactionId": "<existing-id>",
  "type": "SPEND",
  "lineItems": [{
    "description": "test",
    "quantity": 1,
    "unitAmount": 10,
    "accountCode": "404",
    "taxType": "BASEXCLUDED"
  }]
}

Returns: "Error updating bank transaction: An unexpected error occurred while communicating with Xero"
What works (control):

Same tool with the same bankTransactionId succeeds if you only update contactId, date, type, or reference — i.e., any combination of top-level fields without lineItems. This rules out auth / permissions / tenant-resolution / rate-limiting.

Variables tested (all reproduce the failure):

taxType values: BASEXCLUDED, NONE, INPUT, OUTPUT
type: both RECEIVE and SPEND
Source data: bank transactions originally created via API ranging from 2016 through 2026
With and without tracking on the line item
With and without reference on the top-level call
Minimal one-line lineItems and multi-line lineItems

Impact:

Cannot perform a very common workflow — bulk recoding existing bank transactions from a holding account (e.g., #850 Suspense) into their correct chart-of-accounts code after initial import. End users have to fall back to the Xero UI for what should be a programmatic operation.

Suspected cause:

The generic error message strongly suggests the underlying SDK exception is being swallowed in src/handlers/update-bank-transaction.handler.ts. Logging the raw error or axios response body would help. Possible upstream causes:

Payload shape mismatch — e.g., the Xero BankTransactions PUT endpoint may require BankAccount.AccountID in the body when LineItems is present (not currently in the tool schema)
LineItem.LineAmount may be required and not auto-derived from UnitAmount × Quantity on update calls
Reference field may be required when updating (not just optional)

Environment:

MCP server: xero-mcp-server main branch
Auth: Custom Connection (client credentials)
Tested on Australian Xero org (BosHQ trust)

Workaround:

Use the Xero UI's Find & Recode feature, or re-create the bank transaction (delete the existing + create new with correct accountCode).

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions