While using the AI API Explorer module, a PHP warning is triggered when provider configuration values contain arrays.

Error:
Warning: Array to string conversion in Drupal\ai_api_explorer\AiApiExplorerPluginBase->addProviderCodeExample()

Cause:
In AiApiExplorerPluginBase::addProviderCodeExample(), the code assumes non-string values can be directly concatenated into a string. However, when $value is an array, PHP throws an "Array to string conversion" warning.

Steps to Reproduce

  1. Go to this path /admin/config/ai/explorers/chat_generator
  2. Provide some chat message
  3. Click Ask AI button
CommentFileSizeAuthor
Screenshot from 2026-04-03 12-48-54.png75.29 KBrevathi.b

Issue fork ai-3582954

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

revathi.b created an issue. See original summary.

revathi.b’s picture

Status: Active » Needs review

MR !1427 fix this warning.

marcus_johansson’s picture

Assigned: revathi.b » Unassigned
Status: Needs review » Reviewed & tested by the community
Issue tags: +needs backport to 1.2.x, +needs forward port

Thank you for finding and fixing the issue. LGTM

marcus_johansson’s picture

Assigned: Unassigned » marcus_johansson
Issue tags: +AI Initiative Sprint, +AI Product Development
marcus_johansson’s picture

Assigned: marcus_johansson » Unassigned
Status: Reviewed & tested by the community » Fixed

Merged everywhere.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.