Skip to content

[Bug] Admin Panel: adding a new modelSpecs.list entry overwrites index 0 and group-specific model specs are not rendered correctly after save #78

Description

@pkaluza8

I found an issue in the Admin Panel when trying to add new entries under Configuration → Model specs → List.

Admin Panel tag: librechat-admin-panel:e1aa21343e0570ffb75ea5575cee802ca4281853
Librechat tag: v0.8.6

The issue appears in two related scenarios:

  1. When editing the Base configuration, clicking Add entry initially creates a new item and the counter changes from 4/4 to 5/5, but after entering the Name field and moving to the Label field, the list goes back to 4/4. After saving, the new entry does not get appended to the list. Instead, it overwrites the existing entry at position 0.
Image Image Image
  1. When adding a modelSpecs entry for a specific AD group, the configuration seems to be saved to MongoDB, and the main LibreChat UI reacts to this change. However, the saved changes are not visible correctly in the Admin Panel UI after saving. Additionally, the main LibreChat UI can fail with:
Error Message:
x is not iterable
Image

Steps to reproduce
Scenario 1: Base configuration

  1. Open the Admin Panel.
  2. Go to Configuration.
  3. Select Base configuration from the dropdown.
  4. Open the Model specs tab.
  5. Under Model specs → List, click Add entry.
  6. The list counter changes from 4/4 to 5/5.
  7. Enter a value in the Name field, for example:
    TEST1
  8. Move focus to the Label field.
  9. The list counter changes back from 5/5 to 4/4.
  10. Save the configuration.

Actual behavior
The newly added entry is not appended to the list.
Instead, after saving, the first existing model spec entry at index 0 is overwritten by the new entry.
For example, before adding the new entry, the first item was:

smart-assistant

smart-assistantPokaż więcej wierszy
After adding and saving TEST1, the first item becomes:
TEST1

The total number of list entries remains 4/4, so the new item replaces the first existing item instead of being added as a new one.

Scenario 2: Group-specific configuration
The second issue happens when setting a model spec override for a specific AD group.
Steps to reproduce

  1. Open the Admin Panel.
  2. Go to Configuration.
  3. Select a specific AD group from the configuration dropdown, for example:
    AG-Librechat-Admin
  4. Open the Model specs tab.
  5. Add a new entry under Model specs → List.
  6. Fill in fields such as:

Name: TEST
Group: Agents
  1. Save the configuration.
  2. Reopen or refresh the Admin Panel configuration view for the same group

Actual behavior
The change appears to be saved in MongoDB, but it is not rendered correctly in the Admin Panel UI after saving.
The following document is created in the MongoDB config collection:

{
  "_id": "6a3253fd8d703f6da345fc78",
  "principalType": "group",
  "principalId": "69f078d66308f05c49270386",
  "__v": 0,
  "configVersion": 2,
  "createdAt": "2026-06-17T07:59:57.956+00:00",
  "isActive": true,
  "overrides": {
    "modelSpecs": {
      "list": {
        "0": {
          "name": "TEST",
          "group": "Agents"
        }
      }
    }
  },
  "principalModel": "Group",
  "priority": 20,
  "updatedAt": "2026-06-17T08:01:30.972+00:00"
}

This looks like modelSpecs.list is being saved as an object with numeric keys:

"list": {
  "0": {
    "name": "TEST",
    "group": "Agents"
  }
}

instead of an array, for example:

"list": [
  {
    "name": "TEST",
    "group": "Agents"
  }
]

This may explain why the main LibreChat UI fails with x is not iterable, and why the Admin Panel UI does not render the saved group-specific override correctly.

Expected behavior
When saving modelSpecs.list for a group-specific configuration:

  • the value should be saved in a structure that both the Admin Panel and the main LibreChat UI can read correctly;
  • the saved model spec should be visible in the Admin Panel UI after saving or refreshing;
  • the main LibreChat UI should not fail with x is not iterable;
  • the group-specific override should not corrupt or reshape the modelSpecs.list structure.

Impact
This makes it difficult or impossible to safely add new modelSpecs entries from the Admin Panel.
For Base configuration, adding a new model spec can overwrite an existing entry.
For group-specific configuration, saved overrides are not displayed correctly in the Admin Panel UI and may cause the main LibreChat UI to fail with x is not iterable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions