[Bug]: When update specific transfer transaction by id, the opposing account's transaction is updated as well #2226

Open
opened 2026-02-28 20:07:21 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @ngoc-minh-do on GitHub (Jun 24, 2025).

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

I'm trying to update the notes of transfer transactions using the code below (Because the transfer was created automatically when I import the transaction using api.importTransactions(), so the note is inherited from there).
I want to update the notes with original notes from bank provider.

For example:
Bank A transfer transaction notes: "From bank B"
Bank B transfer transaction notes: "To bank A"

Code Snippet:

(async () => {
  try {
    await actualBudgetUtils.init();
    await api.downloadBudget(constants.ACTUAL_SYNC_ID);
    const startDate = moment('2020-01-01').format('YYYY-MM-DD');
    const endDate = moment().format('YYYY-MM-DD');
    const newNotes = 'Imported from Actual Budget';
    const newImportedPayee = 'Actual Budget Import';

    const accounts = (await api.getAccounts()) as APIAccountEntity[];
    for (const account of accounts) {
      const transferTransactions = (
        (await api.getTransactions(account.id, startDate, endDate)) as TransactionEntity[]
      ).filter((tx) => tx.transfer_id);

      for (const transferTransaction of transferTransactions) {
        await api.updateTransaction(transferTransaction.id, {
          notes: newNotes,
          imported_payee: newImportedPayee,
        } as Partial<TransactionEntity>);
      }
    }
  } catch (e) {
    console.trace(e);
  } finally {
    await api.shutdown();
  }
})();

What I Expected:
Bank A transfer transaction notes: "From bank B"
Bank B transfer transaction notes: "To bank A"

What Actually Happened:
Both transfer transaction in Bank A and B have the same notes

Troubleshooting Attempts:
I tried reading through the API source code to understand the issue, but I couldn't identify what I might be doing wrong.

Thank you in advance!

How can we reproduce the issue?

Using the code in the description.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Microsoft Edge

Operating System

Linux

Originally created by @ngoc-minh-do on GitHub (Jun 24, 2025). ### Verified issue does not already exist? - [x] I have searched and found no existing issue ### What happened? I'm trying to update the notes of transfer transactions using the code below (Because the transfer was created automatically when I import the transaction using `api.importTransactions()`, so the note is inherited from there). I want to update the notes with original notes from bank provider. For example: Bank A transfer transaction notes: "From bank B" Bank B transfer transaction notes: "To bank A" Code Snippet: ```ts (async () => { try { await actualBudgetUtils.init(); await api.downloadBudget(constants.ACTUAL_SYNC_ID); const startDate = moment('2020-01-01').format('YYYY-MM-DD'); const endDate = moment().format('YYYY-MM-DD'); const newNotes = 'Imported from Actual Budget'; const newImportedPayee = 'Actual Budget Import'; const accounts = (await api.getAccounts()) as APIAccountEntity[]; for (const account of accounts) { const transferTransactions = ( (await api.getTransactions(account.id, startDate, endDate)) as TransactionEntity[] ).filter((tx) => tx.transfer_id); for (const transferTransaction of transferTransactions) { await api.updateTransaction(transferTransaction.id, { notes: newNotes, imported_payee: newImportedPayee, } as Partial<TransactionEntity>); } } } catch (e) { console.trace(e); } finally { await api.shutdown(); } })(); ``` What I Expected: Bank A transfer transaction notes: "From bank B" Bank B transfer transaction notes: "To bank A" What Actually Happened: Both transfer transaction in Bank A and B have the same notes Troubleshooting Attempts: I tried reading through the API source code to understand the issue, but I couldn't identify what I might be doing wrong. Thank you in advance! ### How can we reproduce the issue? Using the code in the description. ### Where are you hosting Actual? Docker ### What browsers are you seeing the problem on? Microsoft Edge ### Operating System Linux
GiteaMirror added the bugAPI labels 2026-02-28 20:07:21 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#2226