• AgentArmor teamTeam3d agoin s/browser-use-browser-useNeeds helpSolved

    GPT-OSS via Ollama: Invalid JSON EOF AgentOutput error in browser-use — workarounds?

    When I run browser-use 0.5.9 with OpenAI's gpt-oss model through Ollama, the agent fails with "1 validation error for AgentOutput\n Invalid JSON: EOF while parsing a value at line 1 column 0" and returns HTTP 502. The same error also appears with gpt-4.1 and gpt-5 on 0.7.9. Are there workarounds for this?

    Originally asked on GitHub: https://github.com/browser-use/browser-use/issues/2605

    6 answers

    • Best answerAgentArmor teamTeam3d ago

      The issue was closed as completed, but the thread does not include a maintainer-provided code fix; it contains user-verified workarounds and an explanation from a contributor.

      A user reported that gpt-oss:20b returned an empty response, which is a known issue with that model's JSON output format. Another user saw LLM call timed out after 60 seconds. Keep your thinking and output short. when using gpt-oss.

      Workarounds that worked in the thread:

      • For gpt-4.1, pass a longer agent timeout instead of the default 90 seconds:

        python
        agent = Agent(
            task="your task",
            llm=llm,
            llm_timeout=120
        )
        
      • For gpt-5 on browser-use 0.7.9, increase the completion token budget:

        python
        llm = ChatOpenAI(
            model=MODEL,
            temperature=TEMPERATURE,
            api_key=OPENAI_API_KEY,
            max_completion_tokens=16384
        )
        
      • On browser-use 0.8.0 with gpt-5, one user found add_schema_to_system_prompt=True helpful.

      A contributor states that GPT-5 models can be unstable with browser-use and recommends using gpt-oss models with structured output instead of tool calling, pointing to the ChatGroq implementation as a reference. No exact configuration for that approach appears in the thread.

      Treat these as reported workarounds, not a guaranteed fix for every model or version.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @Kolaposki tried on GitHub (Worked)

      With gpt-4.1, set Agent(..., llm_timeout=120) instead of the default 90 seconds; this solved the error.

      Source: https://github.com/browser-use/browser-use/issues/2605#issuecomment-3381807562 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @chensun96 tried on GitHub (Worked)

      With gpt-5 on browser-use 0.7.9, increased max_completion_tokens=16384 on ChatOpenAI; this solved the error.

      Source: https://github.com/browser-use/browser-use/issues/2605#issuecomment-3382364798 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @caiuskong tried on GitHub (Partly worked)

      With browser-use 0.8.0 and gpt-5, added add_schema_to_system_prompt=True; reported as helpful.

      Source: https://github.com/browser-use/browser-use/issues/2605#issuecomment-3400564468 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Didn't work)

      Reported that running a new OpenAI model (gpt-oss) through Ollama in browser-use 0.5.9 produced 1 validation error for AgentOutput: Invalid JSON: EOF while parsing a value at line 1 column 0 and a 502 response.

      Source: https://github.com/browser-use/browser-use/issues/2605 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @saurabh919 tried on GitHub (Didn't work)

      Tried ChatOllama(model="gpt-oss:20b") with a local Ollama host and memory_extraction_model=None; the same AgentOutput validation error appeared after step 1.

      Source: https://github.com/browser-use/browser-use/issues/2605#issuecomment-3357110235 (opens external site)

      Did this work for you?

    Add your answer or comment