Skip to content

Error messages from Gradio spaces don't reach HARP users #44

Description

@saumya-pailwan

Problem:

When a Gradio Space runs into a problem and raises an error, HARP is supposed to read that error message and show it to the user in logs and a popup. Right now, that message never arrives and the user sees nothing useful.

Reason:

This is a bug in Gradio 5.28.0 (the version pyharp currently requires). When Gradio packages an error to send over the network, it looks for the message under the key "data" but errors are actually stored under the key "error". So it always finds nothing, and sends null instead of the actual text.

In code, the broken line in Gradio 5.28.0's routes.py is:

data = msg["output"].get("data") # always returns None for errors

Whats Fixed

(Merged in Gradio 6.x)
This was fixed in Gradio PR #13289 ("Improve curl info"), and is shipped in Gradio 6.17.3 (the latest release as of now).

The fix helps Gradio to look in the right place depending on whether the message is a success or an error:

# After the fix — passes the full error dict when something goes wrong
data = msg["output"].get("data") if message.success else msg["output"]

Now, the SSE stream should correctly send:

event: error
data: {"error": "the actual error message"}

Needed for HARP

Currently (refer issue 349) HARP can't tell the difference between two situations:

  • A Space that was rejected because ZeroGPU had no capacity (expected, no error text arrives)
  • A Space that crashed with a real runtime error (unexpected, should show a message, but the bug hides it)

Because both look identical (no error text), we cannot classify exact error and if the application is in GPU space currently we are getting
"ZeroGPU quota exceeded" and this points users in the wrong direction.

What Needs to Change

Currently in all our requirements.txt file we use the main branch of pyharp and the gradio version is fixed. The setup.pythat requires exactly:

gradio==5.28.0
Upgrading that to the latest version should fix this.
In our current issue 349, in this PR HARP's client code handles the corrected error format.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions