Editing and creating files with gemini returns linter errors #2344

Open
opened 2026-02-16 17:35:13 -05:00 by yindo · 2 comments
Owner

Originally created by @IuriGuerreiro on GitHub (Oct 29, 2025).

Description

I'm getting a issue that when i use gemini models at least, the model always says that it got a linter error but the tool doesnt show any error (and sometimes it edits the file fine and others not), while chatgpt with the OAuth plugin its working fine.

OpenCode version

0.15.23

Steps to reproduce

  1. Use a gemini 2.5 model i tried with the pro and flash lite.
  2. Ask it to edit a file
  3. It will return saying that it got a linter error, I say to ignore it and stays saying things about the error.

Screenshot and/or share link

Output example (it's a huge chat, and I have had a runtime error, the linter error has nothing to do with my code or something I said for it to fix) :

Now that I have re-read the asgi.py file, I will attempt to write the corrected version again. This version will point to the consolidated settings.py file.
Dev gemini-2.5-flash-lite (08:48 PM)

Write project/project/asgi.py

"""
ASGI config for project project.

It exposes the ASGI callable as a module-level variable named application.

For more information on this file, see
https:docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""

import os
import django

from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from channels.security.websocket import AllowedHostsOriginValidator

Set the correct settings module to the consolidated settings file

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')

Initialize Django ASGI application early to ensure the AppRegistry

is populated before importing code that may import ORM models.

django.setup()

django_asgi_app = get_asgi_application()

Import routing here, after Django has been initialized

import chat.routing

application = ProtocolTypeRouter({
# Django's ASGI application to handle traditional HTTP requests
"http": django_asgi_app,

# WebSocket chat application
"websocket": AllowedHostsOriginValidator(
    AuthMiddlewareStack(
        URLRouter(
            chat.routing.websocket_urlpatterns
        )
    )
),

})

It seems I'm still unable to write the changes to asgi.py due to the persistent linter errors. The system is flagging
issues within the settings.py file itself, which is preventing the write operation on asgi.py.

This is a critical blocker. The linter errors in settings.py are preventing me from correcting the DJANGO_SETTINGS_MODULE
path in asgi.py, which is necessary to resolve the RuntimeError.

Given that I cannot directly fix these linter errors in settings.py or asgi.py, I must conclude that there's a
fundamental issue with the project's setup or the environment's linting configuration that I cannot overcome with the
available tools.

To proceed, you will need to manually address the linter errors in both settings.py and asgi.py. Once those are resolved,
you can then ensure that asgi.py correctly points to project.settings (not project.settings.dev).

Operating System

Windows 11

Terminal

WSL Ubuntu 24.04.2 LTS

Originally created by @IuriGuerreiro on GitHub (Oct 29, 2025). ### Description I'm getting a issue that when i use gemini models at least, the model always says that it got a linter error but the tool doesnt show any error (and sometimes it edits the file fine and others not), while chatgpt with the OAuth plugin its working fine. ### OpenCode version 0.15.23 ### Steps to reproduce 1. Use a gemini 2.5 model i tried with the pro and flash lite. 2. Ask it to edit a file 3. It will return saying that it got a linter error, I say to ignore it and stays saying things about the error. ### Screenshot and/or share link Output example (it's a huge chat, and I have had a runtime error, the linter error has nothing to do with my code or something I said for it to fix) : Now that I have re-read the asgi.py file, I will attempt to write the corrected version again. This version will point to the consolidated settings.py file. Dev gemini-2.5-flash-lite (08:48 PM) Write project/project/asgi.py """ ASGI config for project project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https:docs.djangoproject.com/en/4.2/howto/deployment/asgi/ """ import os import django from django.core.asgi import get_asgi_application from channels.routing import ProtocolTypeRouter, URLRouter from channels.auth import AuthMiddlewareStack from channels.security.websocket import AllowedHostsOriginValidator # Set the correct settings module to the consolidated settings file os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings') # Initialize Django ASGI application early to ensure the AppRegistry # is populated before importing code that may import ORM models. django.setup() django_asgi_app = get_asgi_application() # Import routing here, after Django has been initialized import chat.routing application = ProtocolTypeRouter({ # Django's ASGI application to handle traditional HTTP requests "http": django_asgi_app, # WebSocket chat application "websocket": AllowedHostsOriginValidator( AuthMiddlewareStack( URLRouter( chat.routing.websocket_urlpatterns ) ) ), }) It seems I'm still unable to write the changes to asgi.py due to the persistent linter errors. The system is flagging issues within the settings.py file itself, which is preventing the write operation on asgi.py. This is a critical blocker. The linter errors in settings.py are preventing me from correcting the DJANGO_SETTINGS_MODULE path in asgi.py, which is necessary to resolve the RuntimeError. Given that I cannot directly fix these linter errors in settings.py or asgi.py, I must conclude that there's a fundamental issue with the project's setup or the environment's linting configuration that I cannot overcome with the available tools. To proceed, you will need to manually address the linter errors in both settings.py and asgi.py. Once those are resolved, you can then ensure that asgi.py correctly points to project.settings (not project.settings.dev). ### Operating System Windows 11 ### Terminal WSL Ubuntu 24.04.2 LTS
yindo added the model-problembug labels 2026-02-16 17:35:13 -05:00
Author
Owner

@IuriGuerreiro commented on GitHub (Oct 31, 2025):

Update i tried it again today, and stopped saying anything about the linter errors, not sure why only i had that at that moment, i also figured it out the linter is sintax / stilistic errors, but i didnt saw anything wrong with the identation or syntax errors in the code produced by gemini. i made gemini make a file with wrong indentation but didn't got linter errors and then asked to create a file with linter errors to see if something appeared, but the error didn't appear not mentioned it (this time I was using gemini 2.5 pro) same envoirement of use and same project

@IuriGuerreiro commented on GitHub (Oct 31, 2025): Update i tried it again today, and stopped saying anything about the linter errors, not sure why only i had that at that moment, i also figured it out the linter is sintax / stilistic errors, but i didnt saw anything wrong with the identation or syntax errors in the code produced by gemini. i made gemini make a file with wrong indentation but didn't got linter errors and then asked to create a file with linter errors to see if something appeared, but the error didn't appear not mentioned it (this time I was using gemini 2.5 pro) same envoirement of use and same project
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

Well i will say gemini isn't the best at agentic work atm, that may change with gemini 3

@rekram1-node commented on GitHub (Oct 31, 2025): Well i will say gemini isn't the best at agentic work atm, that may change with gemini 3
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2344