All translations are lost / empty if an error occurs in a translation job

Created on 1 August 2025, 13 days ago

Problem/Motivation

Looking at 🐛 TypeError: Drupal\tmgmt_deepl\Plugin\tmgmt\Translator\DeeplTranslator::doRequest(): Return value must be of type array, null returned Active but also previous cases where an error occurred during a translation job, it seems that all translations are lost (for all entities selected for translation) if an error occurs in the translation batch job?

I see the sand clock afterwards for each entity, but the translated strings are all empty, even if the error happens late in the job.

If it's a big job, this is even worse, because the translations are still paid.

Is this a known issue?

Steps to reproduce

Proposed resolution

Process the entities one by one (looks like this is already done) and do not discard translations of successfully translated entities.

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

2.2

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Anybody
  • 🇩🇪Germany SteffenR Germany

    Hi @anybody - thx for posting the issue.

    Looks like the issue is related to the broken return value, as you already mentioned.
    We never run into those issues on any of the sites, we are using the module (but we never tried it with commerce entities/ just "normal content").

    Usually the translations are added to the Drupal entities within the batchFinished callback.

    Another approach would be saving the translations in the "processing step" - there is already an issue concering the process: https://www.drupal.org/project/tmgmt_deepl/issues/3502785 Translations should be saved using operations to avoid exeeding memory or time execution Active
    But this "kind of breaks" the display of completion messages. Maybe you have another idea, how the messages can be fetched and displayed correctly Translations should be saved using operations to avoid exeeding memory or time execution Active .

  • 🇩🇪Germany SteffenR Germany
  • 🇩🇪Germany Anybody Porta Westfalica

    Hi @steffenr thanks for the quick response. I'll come back here asap. FYI: I ran into these "all requested translations empty" issue in the past, I think also with nodes or taxonomy terms.

    I just saw that maybe this happens, if the request is too large, if this makes sense. It feels like it happens, if I select too many entities for one job. If that fails then, all translated fields are empty, while the batch job starts and runs successfully first. Then it fails with an error (any kind, also quota exceeded may happen) and none of the job items has a real translation. All have empty string suggestions.

    Maybe this helps you to track this down more in deep, knowing the code.

    Thanks! (Sorry very busy days, so for now just leaving as much info here as possible for the ftuture)

  • 🇩🇪Germany SteffenR Germany

    Hi @anybody.
    Can you give me some more information on how to reproduce the issue within a simple setup?
    Or do i need to "spin up" a commerce installation, were you originally found the issue.

  • 🇩🇪Germany SteffenR Germany
  • 🇩🇪Germany Anybody Porta Westfalica

    @steffenr sorry this is still on my radar, just very busy days due to teams holiday season. I'll be back here and if I miss it, feel free to ping again in some weeks, sorry!

Production build 0.71.5 2024