Gemini 3 preview - repeating bugs, not finishing to write code, rewrites parts which are not supposed to be changed

Decided to give Gemini 3 preview a try but it’s frustrating. Here is the list of bugs which are repeating again and again. Once I’ve asked Cladue and Gpt why the code is not working and it appeared, that Gemini 3 often makes typos and unfinish code:
#00f3k#00f3ff
#kf#fff
#0k#0ff
#k0#ff0
#k0055#ff0055
#k5500#ff5500
tDikuse → tDiffuse
analyser.ktSize → analyser.fftSize
okset → offset
THREE.js: 0.165.0 → r165

Every prompt finishes with some auto-fix and almost always first attempts to fix doesn’t fix anything:
Uncaught ReferenceError: THREE is not defined
Uncaught TypeError: Cannot read properties of undefined (reading ‘material’)

My apologies, it appears I introduced an error in the last fix by using an incorrect URL for the THREE.js library. This was the root cause of the THREE is not defined error and the subsequent crashes you were seeing.

THREE.js
html

You are absolutely right, and I apologize for that oversight. Thank you for catching my mistake. The CDN link I provided for THREE.js was indeed invalid, which was the direct cause of the errors you were seeing.

Uncaught ReferenceError: THREE is not defined
Uncaught TypeError: Cannot read properties of undefined (reading ‘setRenderTarget’)

Of course. It appears there’s a script loading and execution order issue, which is a classic problem in web development. The error THREE is not defined indicates that your main application script is trying to use the Three.js library before it has been fully loaded and parsed by the browser. The second error is a direct consequence of the first one failing.

Uncaught ReferenceError: THREE is not defined

You are right, that error is persistent and indicates a stubborn script loading race condition. My apologies that the defer approach didn’t fully resolve it.

Uncaught ReferenceError: THREE is not defined
Uncaught ReferenceError: selectSketch is not defined

Of course. I’ve identified the root causes for both errors and implemented a comprehensive fix that not only resolves them but also improves the overall code structure. To fix this properly, I have refactored the code to follow modern best practices:

  • Removed Inline onclick Handlers: I’ve removed all onclick=“…” attributes from the HTML markup.

  • Added Data Attributes and IDs: I’ve added data-sketch attributes to the gallery items and unique IDs to the modal buttons for easy selection from JavaScript.

  • Programmatic Event Listeners: All event handling is now done within the main JavaScript block. I’ve added addEventListener calls that correctly wire up the buttons and gallery items to their corresponding functions.

Uncaught ReferenceError: THREE is not defined

I’ve asked GPT to help :)))
The code CRASHES (critical error)
The file is invalid JS. It breaks here:
locks: { zoom: false, rotateX: false, rotateY: false, rotateZ: false, hue: false, displace: false…
:red_exclamation_mark: Missing closing parentheses and end of script
This means:
the browser isn’t executing any JS
Three.js / p5 / audio / UI — everything is dead
Canvas isn’t initializing
:pushpin: Until the file is finished, the app can’t start at all
:cross_mark: Three.js isn’t initializing (even if the code were intact)
The following are declared in the code:
let scene, camera, renderer, planeMesh, sourceTexture;
But no:
initThree()
new THREE.Scene()
new THREE.WebGLRenderer({ canvas })
renderer.setSize(…)
requestAnimationFrame(loop)
:right_arrow: Canvas is empty because the renderer hasn’t been created
:cross_mark: Shaders are declared, but NOT CONNECTED
Yes:
const vertexShader = …
const effectFragmentShader = …
But no:
new THREE.ShaderMaterial
uniforms
PlaneGeometry
scene.add(mesh)
:right_arrow: GLSL is just text, it’s not used anywhere
:cross_mark: p5.js gallery not implemented
UI is present:

But in JS: ❌ no new p5(...) ❌ no neonCube descriptions CyberGrid, etc. ❌ No preview/use logic ➡️ Gallery buttons do nothing ❌ Audio analysis is not enabled Declared: let audioCtx, analyzer, dataArray; But: ❌ no audioCtx = new AudioContext() ❌ no analyzer = audioCtx.createAnalyser() ❌ no getByteFrequencyData ❌ no update loop ➡️ All u_*_react are always 0 ❌ UI controls ARE NOT RELATED TO PARAMETERS Example: But there are none: document.getElementById('param-zoom').addEventListener(...) ➡️ Moving the slider doesn't change anything ❌ Feedback system not implemented In the shader: uniform sampler2D tPrevFrame; But: ❌ no render targets ❌ no ping-pong buffer ❌ no copy of the previous frame ➡️ Trails are always either black or undefined ❌ Camera / video / image source not connected Yes:
1 Like

Hello @Kseniya_Gerasimenko,

Thank you for sharing this feedback on the Gemini 3 Preview. Detailed reports like this are crucial for tuning its behavior before a wider release.
You might find better results with the following adjustments:

  1. Try to apply changes to smaller sections of the file rather than the whole file at once. This reduces the likelihood of hitting output token limits.
  2. When asking for a change, explicitly add: “Only output the modified lines of code, do not rewrite the entire file.”

Hi! Thank you for advise! Please just tell me about first one - how to apply changes to only a smaller sections? And what about Auto-fix button, does it apply only to small part?

I can’t stop Gemini rewriting the full code after I press auto-fix buttons. This time I switched to Gemini 2.5. It’s first response looked like it was really Gemini 2.5. I’ve pressed auto fix , please see attached screen recordings ( screen recodrings - Google Drive )
I did not record the full process but it has rewritten all 2000+ lines.
And then it switched to some model which loves to say that it is an engineer. I’ve pressed auto-fix again and again it has rewritten the full code. Then I switched to Gemini 3 pro again, pressed auto-fix and it started to rewrite code from the very beginning. Despite all those action the errors are still there, I can auto-fix them forever I guess

@Kseniya_Gerasimenko thank you sharing additional details.

Since AI Studio doesn’t have the “Scoped Edit” feature of the IDE, the model defaults to “verbose” mode.

  • Fix: Add a System Instruction (at the top left of the UI) that says: Strictly output ONLY the modified lines of code. Do not reprint the entire file.

  • Alternative: Use the “Edit” feature on the model’s response directly to remove the hallucinated rewrites if you are using the output for prototyping, or lower the Temperature to 0.2 to reduce its tendency to “improvisational refactoring.”

I’ve tried some System Instructions already and they did not work.
“Edit” feature on the model’s response? I don’t see anything like that. And I don;t see settings of temperature anywhere