Error on the Create Translation screen for custom menu links

Created on 2 April 2025, 1 day ago

Problem/Motivation

Error displayed when I tried to translate the custom menu link.

Error message
Please set a default provider & model for the text translation the AI module settings.

Error message
Warning: Undefined array key "#entity" in Drupal\ai_translate\Form\AiTranslateForm->buildForm() (line 85 of modules/contrib/ai/modules/ai_translate/src/Form/AiTranslateForm.php).

I have only tried a few AI modules.
The status screen also shows the following errors

AI Default Translate text Provider
Please provide a default provider for the text translation
The AI Translate module needs the default Translate Text provider to be configured in the AI module settings. Please configure a default Chat AI system.

Env: Drupal 10.4.5

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΅Japan s-jack Tokyo

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

Comments & Activities

  • Issue created by @s-jack
  • πŸ‡―πŸ‡΅Japan s-jack Tokyo
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Can you confirm you have followed the installation instructions for the module, particularly the requirement to choose, install and set up an AI Provider to handle the connection to your chosen AI service? And if so, have you visited the AI Settings page to select a default provider and model for translations?

  • πŸ‡―πŸ‡΅Japan s-jack Tokyo

    I am trying to gradually phase in the AI module, so my AI provider only has the chat set up in Gemini.

    One question.
    Why do I need to set up all providers that I do not plan to use?

  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Sorry I'm losing you: are you saying "Yes I have followed the instructions to set up an AI Provider (can you link to it for us as well?) and have set the AI's modules default settings to say which provider to use for translations"?

  • πŸ‡―πŸ‡΅Japan s-jack Tokyo

    Sorry, it is very possible that I do not understand the whole picture of the AI module and its configuration.
    After uninstalling the AI Translate module, the error disappeared.

  • πŸ‡―πŸ‡΅Japan s-jack Tokyo

    Even if the AI translation module is poorly configured, the inability to translate menu items manually as usual is still a problem.
    I am attaching a screenshot.
    I cropped the screen capture, but there is nothing at the bottom of the error message.

  • πŸ‡―πŸ‡΅Japan s-jack Tokyo
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Can you confirm which of these provider modules you have installed on the site? https://project.pages.drupalcode.org/ai/providers/matris/

    I can't confirm your issue without being able to replicate your set-up.

    As your screenshot shows, there is a message asking you to do something before you can translate the menu item, including a link to where you need to do it: I also need you to confirm you have done that, because otherwise it is likely the issue is you have misconfigured the module not that the module has a bug.

  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Just to add, the second error in the description is a duplicate of https://www.drupal.org/project/ai/issues/3513409 πŸ› Warning: Undefined array key "#entity" in Drupal\ai_translate\Form\AiTranslateForm Active and should be resolved by the patch there.

    Still require the information in my previous comment to investigate this further.

  • πŸ‡―πŸ‡΅Japan s-jack Tokyo

    Settings at the time of first submission

    admin/config/ai/settings

    Embeddings
    Default provider: No default

    Speech to Speech
    Default provider: No default

    Chat
    Default provider: Gemini
    Default Model: Gemini 1.5 Flash

    Image Classification
    Default provider: No default

    Image and Audio to Video
    Default provider: No default

    Speech To Text
    Default provider: No default

    Text To Speech
    Default provider: No default

    Image to Video
    Default provider: No default

    Text To Image
    Default provider: No default

    Translate Text
    Default provider: No default

    Moderation
    Default provider: No default

    Chat with Image Vision
    Default provider: No default

    Chat with Complex JSON
    Default provider: No default

    admin/config/ai/ai-translate

    AI model used for translating to Japanese: β€”Default from AI module (chat)β€”

    AI model used for translating to English: β€”Default from AI module (chat)β€”

    AI model used for translating to German: β€”Default from AI module (chat)β€”

    AI model used for translating to French: β€”Default from AI module (chat)β€”

    ----------
    Second validation settings (current)

    admin/config/ai/settings

    Chat
    Default provider: Gemini
    Default Model: Gemini 1.5 Flash

    Translate Text
    Default provider: Chat proxy to LLM
    Default provider: Gemini 1.5 Flash

    admin/config/ai/ai-translate

    AI model used for translating to Japanese: Gemini - Gemini 1.5 Flash

    AI model used for translating to English: Gemini - Gemini 1.5 Flash

    AI model used for translating to German: Gemini - Gemini 1.5 Flash

    AI model used for translating to French: Gemini - Gemini 1.5 Flash

    Error message
    Warning: Undefined array key "#entity" in Drupal\ai_translate\Form\AiTranslateForm->buildForm() (line 85 of modules/contrib/ai/modules/ai_translate/src/Form/AiTranslateForm.php).

  • πŸ‡―πŸ‡΅Japan s-jack Tokyo

    Incidentally, uninstalling the AI Translater module (ai_tmgmt) did not remove the error.

  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    Translate Text
    Default provider: No default

    That looks to be the issue: is it possible to set your chosen provider and model in that section?

    The "Warning: Undefined array key "#entity"" error is fixed by the patch in the linked ticket, not by uninstalling any modules.

Production build 0.71.5 2024