AI Services List Is Empty After Upgrading from Mattermost Agents v1 to v2

Applies to: Mattermost Agents plugin (mattermost-ai) v1.x to v2.x upgrade; Mattermost Server v11.x and later

Symptoms: After upgrading the Agents plugin to v2, System Console shows "No AI services added yet" and AI bots stop responding, even though they were working before the upgrade.


🛑 Problem

Agents v1.x stored each bot's AI provider connection inside the bot config entry (config.bots[<name>].service). Agents v2.x uses a separate top-level services list (config.services[]). During upgrade, a one-time migration extracts each bot's embedded service into the new list - but skips any bot that already has a ServiceID set, leaving config.services empty. The migration cannot be re-triggered. Why a bot acquires a ServiceID before the migration runs is not yet fully determined, but the condition is confirmed to occur after upgrade/rollback cycles.

Symptoms

Users or administrators experiencing this issue may see:

No migration needed - bots already use service references
Bot references non-existent service bot_name=<name> service_id=<uuid>
EnsureBots: skipping deactivation for active DB agent

Additional symptoms:

  • System Console > Plugins > Agents shows "No AI services added yet" immediately after upgrading to Agents v2.
  • AI bots stop responding in channels after the upgrade.
  • The log line Migrated legacy config bots to self-service agents table is absent, indicating the second leg of the migration also did not complete.

âś… Solution

Because the migration cannot be re-triggered, recover by manually adding a working AI service, reassigning the agent to it, then checking for orphan agent records.

Step 1 - Gather your AI provider connection details

You need a working endpoint to add as a new service. Use your pre-upgrade config.json backup as a reference - look for the bots key; each bot entry contains a nested service object with the original API URL, model name, and API key. If your provider endpoint or model has changed since the upgrade, use the current values instead.

Values you need:

  • API URL - the provider endpoint (e.g., http://ollama-host:11434/v1)
  • Model name - the model to use (e.g., llama3, mistral)
  • API Key - enter a placeholder such as placeholder if the provider does not require one

Step 2 - Add the AI service manually

  1. Navigate to System Console > Plugins > Agents.
  2. Under AI Services, click Add an AI Service.
  3. Set Service type to OpenAI Compatible for local/self-hosted providers.
  4. Enter the API URL, API Key, and Default model from Step 1.
  5. Click Save.

Step 3 - Reassign or recreate the agent

  1. On the same Agents page, locate the existing agent entry.
  2. If one exists, click Edit and reassign the AI Service field to the service created in Step 2.
  3. If no agent entry appears, click Create Agent, configure it, and assign the new service.
  4. If orphaned agents show up (due to a unclean state), those can be deleted.

⚠️ Important: Do not delete agent records directly from the database. Use the Agents UI so that bot deactivation logic runs correctly and the underlying Mattermost bot user account is handled properly.

Step 4 - Verify normal operation

  1. Tail mattermost.log and confirm Bot references non-existent service no longer appears.
  2. Send a test message to the AI bot in a channel and confirm it responds.

Additional Resources

For more information, see:

Upgrade to Mattermost Agents v2 - Mattermost documentation

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.