Skip to content

in chatgpt-shell-google, error: wrong-type-argument consp nil. The logic for thinkingConfig is not quite correct . #394

@DinoChiesa

Description

@DinoChiesa

The cl-defun chatgpt-shell-google--make-gemini-payload uses a conditional within the generation_config param to maybe add information about thinkingConfig . But when the result of the condition is false this logic adds a nil to the generation_config list. The items in the list are expected to be cons cells. This breaks the attempted subsequent json serialization in shell-maker.

Stacktrace

You can see that the `:data` field ends with `(generation_config (temperature . 1) (topP . 1) nil)` . It is this final `nil` that is causing the problem.

``` Debugger entered--Lisp error: (wrong-type-argument consp nil) shell-maker--json-encode(((system_instruction (parts (text . "You use markdown liberally to structure responses. Always show code snippets in markdown blocks with language labels."))) (contents . [((role . "user") (parts . [(...)]))]) (tools (google_search)) (generation_config (temperature . 1) (topP . 1) nil))) shell-maker-make--curl-command(:url "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:streamGenerateContent?key=AI..." :data ((system_instruction (parts (text . "You use markdown liberally to structure responses. Always show code snippets in markdown blocks with language labels."))) (contents . [((role . "user") (parts . [(...)]))]) (tools (google_search)) (generation_config (temperature . 1) (topP . 1) nil)) :encoding nil :timeout nil :headers ("Content-Type: application/json; charset=utf-8") :fields nil :proxy nil) shell-maker-make-http-request(:async t :url "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:streamGenerateContent?key=AI...&alt=sse" :proxy nil :data ((system_instruction (parts (text . "You use markdown liberally to structure responses. Always show code snippets in markdown blocks with language labels."))) (contents . [((role . "user") (parts . [(...)]))]) (tools (google_search)) (generation_config (temperature . 1) (topP . 1) nil)) :headers ("Content-Type: application/json; charset=utf-8") :filter chatgpt-shell-google--extract-gemini-response :shell ((:history) (:log . #f(compiled-function (format &rest args) #)) (:write-output . #f(compiled-function (output) #)) (:finish-output . #f(compiled-function (success) #)))) chatgpt-shell-google--handle-gemini-command(:model ((:version . "gemini-2.5-pro") (:short-version . "2.5-pro") (:label . "Gemini") (:provider . "Google") (:path . "/v1beta/models/gemini-2.5-pro") (:token-width . 4) (:context-window . 1048576) (:grounding-search . 0) (:url-context) (:thinking-budget-min) (:thinking-budget-max) (:reasoning-effort-selector) (:url-base . chatgpt-shell-google-api-url-base) (:handler . chatgpt-shell-google--handle-gemini-command) (:filter . chatgpt-shell-google--extract-gemini-response) (:payload . chatgpt-shell-google--make-payload) (:url . chatgpt-shell-google--make-url) (:headers . chatgpt-shell-google--make-headers) (:key . chatgpt-shell-google-key) (:validate-command . chatgpt-shell-google--validate-command) (:icon . "gemini-color.png")) :command #("Hello, are you there?" 0 21 (fontified t)) :context nil :shell ((:history) (:log . #f(compiled-function (format &rest args) #)) (:write-output . #f(compiled-function (output) #)) (:finish-output . #f(compiled-function (success) #))) :settings ((:streaming . t) (:temperature) (:system-prompt . "You use markdown liberally to structure responses. Always show code snippets in markdown blocks with language labels."))) ```

Expected

if the condition for thinking param evaluates false, then do not add nil to the list of generation_config. The generation_config list should contain only cons cells.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions