Failed to initialize EViewsRConn.VariantRConn — COM Error 0x800706be at XOPEN(TYPE=R)
Posted: Tue Jul 21, 2026 6:22 am
Hi all,
We're hitting an intermittent error when driving R from EViews via xopen/xon/Xclose inside a program subroutine. The error is raised on a comment line, which is what makes it strange — R shouldn't be able to error on a comment in a healthy session.
Error message:
Error: attempt access index 0/0 in VECTOR_ELT in "# PRINT(R.VERSION.STRING)"
in SUB_SS_UTILITY.PRG on line 354.
Minimal reproducer:
comtimeout(0)
xopen(type=r, case=upper)
xon
library(base)
library(data.table)
library(zoo)
print(R.version.string)
print(.libPaths())
xoff
Xclose
The identical code sometimes passes and sometimes fails within minutes of each other — the only thing varying is the R session state.
The first R call in a fresh EViews session tends to succeed; a second call in the same session fails with the same VECTOR_ELT error, suggesting Xclose isn't fully tearing down the R session and subsequent calls inherit dirty state.
Cold-restarting EViews and killing any leftover RConn*.exe / Rterm.exe / Rscript.exe / Rgui.exe processes clears it.
Forcing a clean environment at the top of the xon…xoff block (rm(list = ls(envir = .GlobalEnv), envir = .GlobalEnv) then gc()) before any library() call appears to prevent it.
The VECTOR_ELT text looks like a C-level error, i.e. R's internal structures becoming inconsistent across repeated xopen/Xclose cycles.
Is this a known issue with the R connection not being fully reset between xopen/Xclose cycles in the same EViews session?
Is there a recommended way to guarantee a clean R session per xopen, short of restarting EViews?
Our setup is working with EViews 13 and R version 4.6.1
Thanks, Ben
We're hitting an intermittent error when driving R from EViews via xopen/xon/Xclose inside a program subroutine. The error is raised on a comment line, which is what makes it strange — R shouldn't be able to error on a comment in a healthy session.
Error message:
Error: attempt access index 0/0 in VECTOR_ELT in "# PRINT(R.VERSION.STRING)"
in SUB_SS_UTILITY.PRG on line 354.
Minimal reproducer:
comtimeout(0)
xopen(type=r, case=upper)
xon
library(base)
library(data.table)
library(zoo)
print(R.version.string)
print(.libPaths())
xoff
Xclose
The identical code sometimes passes and sometimes fails within minutes of each other — the only thing varying is the R session state.
The first R call in a fresh EViews session tends to succeed; a second call in the same session fails with the same VECTOR_ELT error, suggesting Xclose isn't fully tearing down the R session and subsequent calls inherit dirty state.
Cold-restarting EViews and killing any leftover RConn*.exe / Rterm.exe / Rscript.exe / Rgui.exe processes clears it.
Forcing a clean environment at the top of the xon…xoff block (rm(list = ls(envir = .GlobalEnv), envir = .GlobalEnv) then gc()) before any library() call appears to prevent it.
The VECTOR_ELT text looks like a C-level error, i.e. R's internal structures becoming inconsistent across repeated xopen/Xclose cycles.
Is this a known issue with the R connection not being fully reset between xopen/Xclose cycles in the same EViews session?
Is there a recommended way to guarantee a clean R session per xopen, short of restarting EViews?
Our setup is working with EViews 13 and R version 4.6.1
Thanks, Ben