Quick answer: A Ren’Py bug report needs two paths. For crashes, set config.exception_handler to a function that stores the traceback in persistent and returns False, then send the stored traceback with renpy.fetch from label splashscreen on the next launch. For everything else, add a “Report a bug” button to the quick menu that grabs a screenshot with renpy.screenshot_to_bytes, asks one question with renpy.input and posts both. Ren’Py 8.2 or later is required for renpy.fetch.
Every Ren’Py developer knows the support exchange. A reader says the game “broke at the festival scene”, you ask for traceback.txt, and they either cannot find it, send log.txt instead, or never reply. Meanwhile most readers who see the grey error screen click Ignore and say nothing at all. Ren’Py already has everything needed to close that gap: a hook that runs when an exception escapes your script, an HTTP client, and a screenshot function. This guide wires them into a small .rpy file that reports crashes automatically and gives readers a button for everything else.
- Where traceback.txt lives, and why players never send it
- A function that sends a report with renpy.fetch
- Catch crashes with config.exception_handler
- Send the stored traceback on the next launch
- Add a Report a bug button and an F8 key
- Web, Android and older Ren’Py versions
- Where the reports go
- Related guides
- Frequently asked questions
Where traceback.txt lives, and why players never send it
When an exception escapes your script, Ren’Py writes traceback.txt into the game’s base directory, the folder that contains the executable and the game folder. log.txt (general engine log) and errors.txt (script parse errors) go to the same place. Those three files are what you ask for in every support thread.
The trouble is everything around them:
- Steam and itch.io app users rarely know where the install folder is.
- If the install folder is not writable, Ren’Py falls back to a different location, so “next to the exe” is not always true.
- On Android and iOS the files are in app storage that is awkward or impossible for a player to browse. On web builds there is no file to send.
traceback.txtis overwritten by the next error, so the one you needed may already be gone.- The error screen offers Rollback, Ignore and Quit. Ignore usually works well enough that the reader keeps going and never reports anything.
The fix is to stop relying on the file and have the game deliver the same text itself.
A function that sends a report with renpy.fetch
renpy.fetch arrived in Ren’Py 8.2. It takes a json argument (which makes the request a POST with a JSON body), a headers dict and a timeout, and raises FetchError when the request fails. It is meant to be called from the main thread once the game has started, which shapes the design below: no network calls during init, and none from inside the exception handler.
Create game/bug_report.rpy and start with the sender. The examples post to Bugnet’s public report endpoint; any HTTP endpoint that accepts JSON works the same way.
define BUGNET_URL = "https://api.bugnet.io/api/bugs/submit"
define BUGNET_KEY = "sk_live_your_project_key"
init python:
def bugnet_platform():
if renpy.android:
return "Android"
if renpy.ios:
return "iOS"
if renpy.emscripten:
return "Web"
if renpy.windows:
return "Windows"
if renpy.macintosh:
return "macOS"
return "Linux"
def bugnet_post(payload):
"""Send one report. Returns True when the server accepted it."""
import platform
payload.setdefault("platform", bugnet_platform())
payload.setdefault("game_version", config.version)
try:
payload.setdefault("os_info", platform.platform()[:100])
except Exception:
pass
try:
reply = renpy.fetch(
BUGNET_URL,
json=payload,
headers={"X-API-Key": BUGNET_KEY},
timeout=10,
result="json",
)
return bool(reply.get("ok"))
except Exception as e:
print("Bug report not sent:", e)
return False
Two details matter. config.version is the version string you set in options.rpy; bump it on every release, because “which build?” is the first question every report raises. And the function never lets an exception out: a reporting failure must not become a second crash.
Catch crashes with config.exception_handler
config.exception_handler is called when an exception escapes while the script is running. It receives three arguments: a short traceback limited to your own files, the full traceback, and the path of the traceback file. If it returns True, Ren’Py ignores the exception and carries on with the next statement. If it returns False, the normal error screen appears.
It is tempting to send the report right there. Do not. The game is in an unknown state, renpy.fetch wants a healthy main thread, and the reader may quit before the request finishes. Store the text and return:
init python:
def bugnet_on_exception(short, full, traceback_fn):
try:
persistent.bugnet_crash = {
"short": short[-4000:],
"full": full[-30000:],
"where": list(renpy.get_filename_line()),
"tries": 0,
}
renpy.save_persistent()
except Exception:
pass
return False # show Ren'Py's normal error screen
config.exception_handler = bugnet_on_exception
persistent survives a quit and a crash to desktop, and renpy.save_persistent() writes it to disk immediately instead of waiting for a clean exit. Returning False keeps Ren’Py’s own behaviour, so the reader still gets Rollback, Ignore and Quit.
Returning True to hide errors from readers is possible, but be careful: the statement that failed is skipped, so a variable may be unset or a scene never shown, and the next error will be harder to explain. If you do it, do it only in release builds and always record the traceback first.
One limit: the handler covers exceptions raised while the script runs. Errors during startup, such as a script that fails to parse, happen before it is consulted. Those fail on every launch, so you will catch them in your own testing.
Send the stored traceback on the next launch
label splashscreen runs after init and before the main menu, which makes it the first safe place for a network call. If your game already has a splashscreen label, add the one $ line to it.
init python:
def bugnet_send_pending_crash():
crash = persistent.bugnet_crash
if not crash:
return
lines = [l for l in crash["short"].splitlines() if l.strip()]
title = lines[-1].strip()[:200] if lines else "Unhandled exception"
sent = bugnet_post({
"title": title,
"description": crash["short"] + "\n\n" + crash["full"],
"category": "crash",
"priority": "high",
"auto_captured": True,
"metadata": {
"renpy": renpy.version_only,
"script": crash.get("where"),
},
})
crash["tries"] = crash.get("tries", 0) + 1
if sent or crash["tries"] >= 3:
persistent.bugnet_crash = None
renpy.save_persistent()
label splashscreen:
$ bugnet_send_pending_crash()
return
The title is the last line of the short traceback, which is the exception type and message, for example NameError: name 'affection_mika' is not defined. That choice is deliberate. A tracker that groups reports by title will stack fifty readers hitting the same typo into one report with fifty occurrences, instead of fifty separate entries. Do not add the date, the reader’s name or the save slot to the title.
The three-attempt cap stops a report the server keeps refusing from being retried on every launch forever. An offline reader costs at most the fetch timeout on the next start, and only when a crash is pending.
Add a Report a bug button and an F8 key
Crashes are the minority. Most visual novel bugs are a wrong sprite, a line attributed to the wrong character, a choice that leads to the wrong branch or a typo. Nothing throws, so the reader has to tell you, and they will only do it if it takes ten seconds.
The action below runs while the scene is still on screen. It records the script line being shown and takes the screenshot before any prompt covers the scene, then opens a small label in a new context so the reader’s place in the story is untouched.
init python:
def bugnet_open_report():
where = renpy.get_filename_line()
try:
shot = renpy.screenshot_to_bytes((960, 540))
except Exception:
shot = None
renpy.call_in_new_context("bug_report", where, shot)
def bugnet_send_manual(text, where, shot):
import base64
payload = {
"title": text[:80],
"description": "%s\n\nScript: %s line %s" % (text, where[0], where[1]),
"metadata": {
"renpy": renpy.version_only,
"script": where[0],
"line": where[1],
"language": renpy.game.preferences.language or "default",
},
}
if shot:
payload["screenshot"] = base64.b64encode(shot).decode("ascii")
return bugnet_post(payload)
config.overlay_screens.append("bug_key")
screen bug_key():
key "K_F8" action Function(bugnet_open_report)
label bug_report(where=("unknown", 0), shot=None):
$ bug_text = renpy.input("What went wrong? Your note, a screenshot and the game version are sent to the developer.", length=400).strip()
if bug_text:
if bugnet_send_manual(bug_text, where, shot):
"Thanks. Your report was sent."
else:
"The report could not be sent. Check your connection and try again."
return
Then add the button to the quick menu in screens.rpy, next to Save and Prefs:
textbutton _("Bug") action Function(bugnet_open_report)
A few notes on the choices:
- Quick menu, not the game menu. From the quick menu the screenshot shows the scene and the recorded line is the line of dialogue on screen. From the pause menu both would describe the menu.
- One question. A form with title, category, steps and severity gets abandoned. The script file and line number already tell you where; the screenshot tells you what.
- 960 by 540.
renpy.screenshot_to_bytesreturns PNG bytes at the size you ask for. A smaller image uploads quickly on a phone connection and still shows which sprite is wrong. - The key. The overlay screen is shown during play and hidden in menus. Pick any key your game does not already use.
- The prompt says what is sent. Tell readers in the same sentence that asks for their note, and mention it in your privacy notes.
The script file and line are especially valuable in a branching story. “The festival scene” could be six labels; game/chapter3.rpy line 412 is one.
Web, Android and older Ren’Py versions
Web builds. renpy.fetch works in the browser. The request is cross-origin from wherever the game is hosted, so the receiving server has to allow it. Bugnet’s report endpoint accepts browser requests from any origin, including the sandboxed frames itch.io serves games from.
Android and iOS. The same code runs unchanged. renpy.input brings up the on-screen keyboard. This is where automatic reports pay off most, because nobody is going to dig a text file out of a phone.
Ren’Py 8.1 and earlier, and Ren’Py 7. There is no renpy.fetch. Desktop builds can make the request with Python’s own HTTP modules on a background thread started with renpy.invoke_in_thread, but that approach does not carry over to web builds. If you are still shipping updates, moving to a current 8.x release is the simpler route.
Rate limits. One pending crash per launch and one manual report per button press will never trouble a limit. If you add more automatic reports, for example from a custom error-prone minigame, send each distinct message once per session.
Where the reports go
The code above targets Bugnet’s public report API: one POST to /api/bugs/submit with the project key in X-API-Key. The key is an ingestion key, so it is safe to ship inside the game; it can file reports but cannot read them. There is no Ren’Py SDK to install, and none is needed, because the script above is the whole integration.
In the dashboard each report shows the traceback or the reader’s note, the screenshot, the platform, your config.version and the metadata you attached. Identical crash titles stack as occurrences, so the list sorts itself by how many readers a bug is hitting. You can mark a report in progress or resolved, post it to Discord, and publish fixed issues on a public tracker and changelog so readers can see that the typo they reported was fixed in 1.0.3. The free plan covers one project and up to 100 bug reports, which is enough to get a visual novel through a demo and a launch week. The quickstart shows where to find the key.
Related guides
- Bug Reporting for Visual Novel Developers
- Why Visual Novels Crash When Paths Branch
- Visual novel Crashing? How to Find and Fix It
- A Bug Report API for Games: Submit Reports from Launchers, Servers and Tools
- In-Game Bug Reporting Form Best Practices for Game Developers
Frequently asked questions
Where does Ren’Py save traceback.txt?
Ren’Py writes traceback.txt, log.txt and errors.txt to the game’s base directory, the folder that holds the executable and the game folder. If that folder is not writable it falls back to another location, and on phones the files sit in app storage most players cannot browse.
Can a Ren’Py game send an HTTP request?
Yes. Ren’Py 8.2 and later include renpy.fetch, which can GET, POST and PUT, accepts a json argument and custom headers, and works on desktop, mobile and web builds. It is meant to be called from the main thread after the game has started.
How do I catch errors in Ren’Py without the player seeing the error screen?
Set config.exception_handler to a function that takes the short traceback, the full traceback and the traceback file path. Returning True ignores the exception and continues with the next statement, and returning False shows the normal error screen. Record the error either way so you know it happened.
Does error reporting with renpy.fetch work in Ren’Py web builds?
Yes. renpy.fetch works in the browser, and the request succeeds as long as the server allows cross-origin requests. Bugnet’s report endpoint accepts browser requests from any origin, so a web build on itch.io can report like a desktop build.
Is there a Bugnet SDK for Ren’Py?
There is no dedicated Ren’Py SDK. Ren’Py games use Bugnet’s public HTTP API, a single POST with an X-API-Key header and a JSON body, which renpy.fetch can send directly.
A reader who hits an error screen clicks Ignore and keeps reading. Make the game remember the traceback and send it on the next launch, and you never have to ask for a file again.