Skip to content

[Bug] Gemini request wraps message in extra table nesting — likely API rejection #35

Open

Description

@PyDevC

File: lua/model_cmp/modelapi/gemini.lua:54

Introduction: table.insert(messages, { mainmsg }) wraps mainmsg (already a proper table {role="user", parts={...}}) in an extra {}. The Gemini API receives {{role, parts, ...}} instead of {role, parts, ...}, likely causing API rejection.

Detailed Description: Line 47-52 builds mainmsg as a correctly structured message table. Line 54 wraps it again: { {role="user", parts={...}} }. The system_instruction and contents fields in the JSON body expect flat message arrays.

Reproduction:

  1. :ModelCmpStart gemini
  2. Set GEMINI_API_KEY environment variable
  3. Type anything — Gemini silently returns an error or unexpected response

System detail: Gemini API users.

Activity

  1. added
    bug
    LLMops
    AI gen
    on May 24, 2026
  2. PyDevC commented on May 26, 2026

    @PyDevC
    OwnerAuthor

    Need some testing. It's been a while since I created it and it works so need to look why it can be a problem.

  3. added
    maintainer triaged
    and removed
    LLMops
    on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI genbugmaintainer triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions