Skip to content

Visual editor: "RangeError: Position N out of range" when toggling from Source, when document ends with a link and contains an image wrapped in a link #19588

Open

Description

@klittle314

Note: error report created by interacting with Posit Assistant 1.11.1, the human would have given up without help.

visual_editor_rangeerror_control_passes.qmd.txt
visual_editor_rangeerror_repro.qmd.txt

System details

-   RStudio 2026.10.1+239, Windows 11 (10.0.26200, x64), R 4.2.2
  • Quarto .qmd, editor: visual, CRLF line endings, UTF-8

Steps to reproduce the problem

  • Open the attached `visual_editor_rangeerror_repro.qmd.txt and edit extension to qmd as GitHub does not seem to accept .qmd as valid extension.
  • Toggle between Source and Visual.

Describe the problem in detail

Actual: When switching between Source and Visual, an error dialog shows RangeError: Position 9007 out of range (the number was from my full 10.8 KB document; it is near the end of the file).
What triggers it

  • The document's last paragraph ends with an inline link, with nothing after it: See [ProPublica web-based article](https://www.propublica.org/article/east-orange-va-hospital-veterans-decline-new-jersey).
  • The body also contains an image wrapped in a link: [![Care Settings Guidance](images/Settings%20of%20Care.jpg)](https://...pdf).
  • With both present, the toggle fails. The attached visual_editor_rangeerror_control_passes.qmd.txt (again, remove the .txt extension) differs only by removing the linked-image paragraph, and it works.

Other observations

  • Both elements are needed. The link at the end of the file with no linked image in the file does not fail, and the linked image alone does not fail either.
  • Adding a space or a period after the final link does not fix it. Adding several words after the link does.
  • Other links earlier in the document work normally.
  • A minimal file I wrote (heading, one image-in-link, final link) did not reproduce the error, so the failure may depend on something else in the document, such as its length or position offsets.
  • Failing file contents: headings, hard line breaks, a pipe table, bold text and curly quotes.

Workaround: Add several words of text after the final link, or make the screenshot a plain image with the link as separate text.

Describe the behavior you expected

The view switches without an error.

  • 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.

Activity

  1. added theissue type on Nov 12, 2026
  2. added
    visual markdown
    on Nov 12, 2026
  3. self-assigned this
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsupportvisual markdown

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions