Skip to content

savehistory() and loadhistory() fail without an error on Windows #19687

Closed

Description

@kevinushey

System details

RStudio Edition : Desktop
RStudio Version : main (2026.12 development)
OS Version      : Windows
R Version       : all

Steps to reproduce the problem

  1. On Windows, run savehistory("C:/no-such-folder/history.Rhistory").
  2. Run loadhistory("no-such-file").

Describe the problem in detail

Both calls return without an error, though nothing was saved or loaded.

On Windows, RStudio replaces utils::savehistory() and utils::loadhistory() with .rs.savehistory() / .rs.loadhistory(), which call rs_saveHistory / rs_loadHistory (src/cpp/r/session/RSession.cpp). rs_saveHistory ignores the error returned by ConsoleHistory::saveToFile(), and rs_loadHistory only writes the error to the session log.

On macOS and Linux, RStudio implements these functions through R's history callbacks instead (Rsavehistory / Rloadhistory in RStdCallbacks.cpp), and both report failures as R errors, e.g. No such file or directory.

Found while working on #19684, where this silence hid a path-encoding bug.

Describe the behavior you expected

savehistory() and loadhistory() raise an error when they can't save or load the file, as they do on macOS and Linux.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions