Skip to content

[Bug]: Can't search traces on my self-served instance.  #3448

@MSusik

Description

@MSusik

What component(s) are affected?

  • Opik Python SDK
  • Opik Typescript SDK
  • Opik Agent Optimizer SDK
  • Opik UI
  • Opik Server
  • Documentation

Opik version

  • Opik version: 1.4.5

Describe the problem

I get an API Error when I try to find some traces :

import opik

opik_instance = opik.Opik()

opik_instance.search_traces('project_name', max_results=10, filter_string='metadata.user_assigned_session_id = "testq"')

The error's stacltrace sshown below.

When I inspect get_traces_by_project function, I notice that the returned _response looks like it was cut.

The input of the trace, is a string that is not a coorect JSON - it looks as if a string dump of JSONwas limited to a prefix.

When I visit one of the traces from the search in the UI, it shows the error in the Error part of the trace view:

exception_type: Exception
traceback: |-
  GeneratorExit()Traceback (most recent call last):


    File "/app/.venv/lib/python3.12/site-packages/langgraph/pregel/__init__.py", line 2015, in astream
      yield o


  GeneratorExit

Reproduction steps and code snippets

No response

Error logs or stack trace

  File ".venv/lib/python3.11/site-packages/opik/api_objects/opik_client.py", line 638, in search_traces
    page_traces = self._rest_client.traces.get_traces_by_project(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/tenacity/__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/tenacity/__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/tenacity/__init__.py", line 376, in iter
    result = action(retry_state)
             ^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/tenacity/__init__.py", line 398, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
                                     ^^^^^^^^^^^^^^^^^^^
  File "/home/msusik/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/msusik/Projects/llms/rag/rag-engine/.venv/lib/python3.11/site-packages/tenacity/__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/opik/rest_api/traces/client.py", line 183, in get_traces_by_project
    parse_obj_as(
  File "/home/msusik/Projects/llms/rag/rag-engine/.venv/lib/python3.11/site-packages/opik/rest_api/core/pydantic_utilities.py", line 65, in parse_obj_as
    return adapter.validate_python(dealiased_object)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/pydantic/type_adapter.py", line 412, in validate_python
    return self.validator.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for TracePagePublic
content.1.input
  Input should be a valid dictionary [type=dict_type, input_value='{"messages":[],"question...chant_name":null,"dista', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/dict_type

Healthcheck results

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions