Skip to content

open router deepseek error makes entire task fail #6

@jjoshua2

Description

@jjoshua2

we should catch and retry parsing errors to note waste all the prior compute. or at least be able to see what the first few iterations got. it was on the final one in Enhanced, and I can't even see the 2nd or 3rd one which was probably already pretty good.

[2025-07-25 23:07:17,457: ERROR/MainProcess] app.worker.solve_enhanced_task[552200cc-79fa-447f-8a51-25193ff83112]: Enhanced solve task failed: 552200cc-79fa-447f-8a51-25193ff83112 - OpenRouter API error: Invalid response format from OpenRouter
[2025-07-25 23:07:17,536: ERROR/MainProcess] Task app.worker.solve_enhanced_task[552200cc-79fa-447f-8a51-25193ff83112] raised unexpected: ProviderError('OpenRouter API error: Invalid response format from OpenRouter')
Traceback (most recent call last):
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\providers\openrouter.py", line 117, in complete
    data = response.json()
  File "C:\Users\jjosh\AppData\Roaming\Python\Python313\site-packages\httpx\_models.py", line 832, in json
    return jsonlib.loads(self.content, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "C:\Python313\Lib\json\decoder.py", line 345, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python313\Lib\json\decoder.py", line 363, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2559 column 1 (char 14069)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\agents\professor.py", line 114, in run
    response = await self._generate_with_functions(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\agents\professor.py", line 218, in _generate_with_functions
    return await self._generate(
           ^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\agents\base.py", line 94, in _generate
    return await self.provider.complete(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
    )
    ^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\providers\openrouter.py", line 132, in complete
    raise ProviderError(f"OpenRouter API error: {str(e)}") from e
app.core.providers.base.ProviderError: OpenRouter API error: Expecting value: line 2559 column 1 (char 14069)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\providers\openrouter.py", line 120, in complete
    raise ProviderError("Invalid response format from OpenRouter")
app.core.providers.base.ProviderError: Invalid response format from OpenRouter

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\jjosh\AppData\Roaming\Python\Python313\site-packages\celery\app\trace.py", line 453, in trace_task
    R = retval = fun(*args, **kwargs)
                 ~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\jjosh\AppData\Roaming\Python\Python313\site-packages\celery\app\trace.py", line 736, in __protected_call__
    return self.run(*args, **kwargs)
           ~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\jjosh\warp\Crux\crux-agent\worker.py", line 126, in solve_enhanced_task
    result = asyncio.run(_solve_enhanced_async(job_id, request_data, self))
  File "C:\Python313\Lib\asyncio\runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "C:\Python313\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "C:\Python313\Lib\asyncio\base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "C:\Users\jjosh\warp\Crux\crux-agent\worker.py", line 257, in _solve_enhanced_async
    solution = await runner.solve(
               ^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\orchestrators\enhanced.py", line 158, in solve
    professor_solution = await professor_engine.solve(professor_problem)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\engine\self_evolve.py", line 121, in solve
    gen_result = await self.generator.run(gen_context)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\agents\professor.py", line 171, in run
    response = await self._generate(
               ^^^^^^^^^^^^^^^^^^^^^
        prompt=fallback_prompt,
        ^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\agents\base.py", line 94, in _generate
    return await self.provider.complete(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
    )
    ^
  File "C:\Users\jjosh\warp\Crux\crux-agent\app\core\providers\openrouter.py", line 132, in complete
    raise ProviderError(f"OpenRouter API error: {str(e)}") from e
app.core.providers.base.ProviderError: OpenRouter API error: Invalid response format from OpenRouter

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