Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Pipeline crashed with 'NoneType' object has no attribute 'get' when optional parameters or array items were null—occurring in basic chat scenarios with default Open WebUI configurations.

Root Causes

Null optional parameters: __metadata__, __user__, __event_emitter__, and file_obj.meta can be None when no filters installed, in system contexts, or during testing.

Null items in arrays: messages and content_list arrays can contain None items during error conditions or data corruption.

Changes

Optional parameter guards (4 locations):

# Before: Direct access causes AttributeError
features = __metadata__.get("features", {})
self.user = Users.get_user_by_id(__user__["id"])
mime = file_obj.meta.get("content_type", "image/png")
await __event_emitter__({...})

# After: Null-safe access with fallbacks
metadata = __metadata__ or {}
features = metadata.get("features", {})
self.user = Users.get_user_by_id(__user__["id"]) if __user__ else None
mime = (file_obj.meta or {}).get("content_type", "image/png")
if __event_emitter__:
    await __event_emitter__({...})

Array iteration guards (4 locations):

# Before: Crashes on None items
for message in messages:
    role = message.get("role")  # AttributeError if message is None
    
# After: Skip None items
for message in messages:
    if not message:
        continue
    role = message.get("role")

Applied to loops in: _extract_history_images, _prepare_content, _process_multimodal_content, _build_image_generation_contents.

Impact

Eliminates crashes in basic chat workflows. Pipeline now gracefully handles null data from Open WebUI's stable release and edge cases during error recovery.

Original prompt

This section details on the original issue you should resolve

<issue_title>After configuring the Gemini pipeline, chatting with the LLM doesn't work and it shows an error message</issue_title>
<issue_description>### Question summary

I am not able to make the pipeline work. When I chat with Gemini I get this error: "'NoneType' object has no attribute 'get'". Am I missing something in the pipeline config?

Details

I have followed the steps in the README file. I added the pipeline code as a new function, then I added the WEBUI_SECRET_KEY parameter in the open webui container, recreated the container, then I added my google api key in the valves config, and finally I enabled the function.

I am able to see the gemini models listed in the Models section of the Admin Panel's Settings, but when chatting with any gemini model, I get this error:

  • 'NoneType' object has no attribute 'get'
Image

The logs indicate this:
DEBUG | open_webui.main:process_chat:1746 - Error processing chat payload: 'NoneType' object has no attribute 'get'

Is there a configuration I am missing? I reviewed all the valves configurations and everything seems to have their own default value except for the Api Key (which I already added and shows encripted).

What have you tried?

I've tried different gemini models with the same result (the error message). When using the openai url of gemini as a normal connection in opne webui, it works correctly. </issue_description>

<agent_instructions>Check where this error might occur and implement a fix, and update the documentation if necessary.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@owndev Hi @swever826

Could you please try the following google_gemini.py and give me feedback on whether the problem was solved?</comment_new>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: owndev <69784886+owndev@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix NoneType error in Gemini pipeline chat functionality Fix AttributeError on None parameters in Gemini pipeline Feb 9, 2026
Copilot AI requested a review from owndev February 9, 2026 14:16
Co-authored-by: owndev <69784886+owndev@users.noreply.github.com>
Copilot AI changed the title Fix AttributeError on None parameters in Gemini pipeline Fix NoneType errors from null parameters and array items in Gemini pipeline Feb 9, 2026
@owndev owndev closed this Feb 10, 2026
@owndev owndev deleted the copilot/fix-gemini-pipeline-error branch February 10, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After configuring the Gemini pipeline, chatting with the LLM doesn't work and it shows an error message

2 participants