gitbutlerapp/gitbutler · error
webReadFile is not implemented for the web version
Error message
webReadFile is not implemented for the web version
What it means
webReadFile is the web-build stub for reading a file from disk. Browsers cannot access arbitrary filesystem paths, so this TODO placeholder throws unconditionally; it fires whenever desktop-oriented code attempts to read a local file while running in the web version.
Solutions
- Guard call sites with a platform check so filesystem reads are only attempted in the desktop build
- Catch the error and surface a 'file access is not available in the web version' message
- If the feature is needed on web, obtain file bytes via a file picker or a backend HTTP endpoint instead of a local path
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at apps/desktop/src/lib/backend/web.ts:241 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/576e76330499256a.
Report an issue: GitHub.
Appendix: source
Thrown at apps/desktop/src/lib/backend/web.ts:241
*/
function webListen<T>(event: EventName, handle: EventCallback<T>) {
const webListener = WebListener.getInstance();
return webListener.listen({ name: event, handle });
}
async function webCheckUpdate(): Promise<null> {
// TODO: Implement this for the web version if needed
return null;
}
async function webCurrentVersion(): Promise<string> {
// TODO: Implement this for the web version if needed
return "0.0.0";
}
async function webReadFile(_path: string): Promise<Uint8Array> {
// TODO: Implement this for the web version if needed
throw new Error("webReadFile is not implemented for the web version");
}
async function webOpenExternalUrl(href: string): Promise<void> {
window.open(href, "_blank");
return await Promise.resolve();
}
class WebListener {
private socket: ReconnectingWebSocket | undefined;
private count = 0;
private handlers: { name: EventName; handle: EventCallback<any> }[] = [];
private static instance: WebListener | undefined;
private constructor() {}
static getInstance(): WebListener {
if (!WebListener.instance) {
WebListener.instance = new WebListener();View on GitHub (pinned to 58e5313667)