Skip to content

[Bug]: prometheus_system for callbacks will thrown FileNotFoundError: [Errno 2] No such file or directory: '/app/.py' on startup #13647

@nekomeowww

Description

@nekomeowww

What happened?

When followed https://docs.litellm.ai/docs/proxy/prometheus#advanced-configuration and configured the prometheus_system to monitor the services (DB, Redis) related to LiteLLM system...

This error was thrown:

  File "/usr/lib/python3.13/site-packages/litellm/proxy/types_utils/utils.py", line 50, in get_instance_fn

    raise e

  File "/usr/lib/python3.13/site-packages/litellm/proxy/types_utils/utils.py", line 32, in get_instance_fn

    spec.loader.exec_module(module)  # type: ignore

    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^

  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module

  File "<frozen importlib._bootstrap_external>", line 1159, in get_code

  File "<frozen importlib._bootstrap_external>", line 1217, in get_data

FileNotFoundError: [Errno 2] No such file or directory: '/app/.py'

Relevant log output

File "/usr/lib/python3.13/contextlib.py", line 214, in __aenter__

    return await anext(self.gen)

           ^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 591, in proxy_startup_event

    await initialize(**worker_config)

  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 3046, in initialize

    ) = await proxy_config.load_config(router=llm_router, config_file_path=config)

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 1758, in load_config

    initialize_callbacks_on_proxy(

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

        value=value,

        ^^^^^^^^^^^^

    ...<2 lines>...

        litellm_settings=litellm_settings,

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    )

    ^

  File "/usr/lib/python3.13/site-packages/litellm/proxy/common_utils/callback_utils.py", line 260, in initialize_callbacks_on_proxy

    get_instance_fn(

    ~~~~~~~~~~~~~~~^

        value=callback,

        ^^^^^^^^^^^^^^^

        config_file_path=config_file_path,

        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    )

    ^

  File "/usr/lib/python3.13/site-packages/litellm/proxy/types_utils/utils.py", line 50, in get_instance_fn

    raise e

  File "/usr/lib/python3.13/site-packages/litellm/proxy/types_utils/utils.py", line 32, in get_instance_fn

    spec.loader.exec_module(module)  # type: ignore

    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^

  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module

  File "<frozen importlib._bootstrap_external>", line 1159, in get_code

  File "<frozen importlib._bootstrap_external>", line 1217, in get_data

FileNotFoundError: [Errno 2] No such file or directory: '/app/.py'

Are you a ML Ops Team?

Yes

What LiteLLM version are you on ?

ghcr.io/berriai/litellm:main-stable with hash 0bd8fa78278fb5fdf3fa2d2d4cf9ec33e3a1c9c67d22c557479664f123479857

Twitter / LinkedIn details

@AyakaNeko

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions