OHDSI Home | Forums | Wiki | Github

Achilles invalid 'nchars' argument

Failing to use achilles using R 4.3.2 due to an invalid 'nchars' argument error.

Has anyone else run into this issue? I’m at a loss for how to solve …
stdout:

CDM Version 5.4 passed as parameter.
CDM Version 5.4 passed as parameter.
Beginning multi-threaded execution
Beginning multi-threaded execution
Connecting using PostgreSQL driver
  |======================================================================| 100%
Executing SQL took 1.5 secs
Inserting data took 0.454 secs
Dropping scratch Achilles tables from schema hep_hrn_2023q3_results
Dropping scratch Achilles tables from schema hep_hrn_2023q3_results
  |======================================================================| 100%
Temporary Achilles tables removed from schema hep_hrn_2023q3_results
Temporary Achilles tables removed from schema hep_hrn_2023q3_results
Executing multiple queries. This could take a while
Executing multiple queries. This could take a while
Merging scratch Achilles tables
Merging scratch Achilles tables
Done. Achilles results can now be found in schema hep_hrn_2023q3_results
Done. Achilles results can now be found in schema hep_hrn_2023q3_results
Dropping scratch Achilles tables from schema hep_hrn_2023q3_results
Dropping scratch Achilles tables from schema hep_hrn_2023q3_results
  |======================================================================| 100%
Temporary Achilles tables removed from schema hep_hrn_2023q3_results
Temporary Achilles tables removed from schema hep_hrn_2023q3_results
Connecting using PostgreSQL driver
  |                                                                      |   0%An error report has been created at  output/errorReportR.txt
[WARNING]	2023-12-06T19:36:56.329Z	68cf4690-ac11-4aa5-aab0-d3071913cfbf	R[write to console]: Error in writeChar(report, fileConn, eos = NULL) :
invalid 'nchars' argument
[ERROR] RRuntimeError: Error in writeChar(report, fileConn, eos = NULL) :
invalid 'nchars' argument

errorReportR.txt

Thread: Main
Message:  invalid 'nchars' argument
Level:  FATAL
Time:  2023-12-06 19:36:56

Stack trace:
11: h(simpleError(msg, call))
10: .handleSimpleError(function (condition)
{
    if (is(condition, "error")) {

9: writeChar(report, fileConn, eos = NULL)
8: .createErrorReport(dbms, err$message, sqlStatement, errorReportFile)
7: value[[3]](cond)
6: tryCatchOne(expr, names, parentenv, handlers[[1]])
5: tryCatchList(expr, classes, parentenv, handlers)
4: tryCatch({
    startQuery <- Sys.time()
    rowsAffected <- c(rowsAffected, l
3: DatabaseConnector::executeSql(connection = connection, sql = paste(indicesS
2: createIndices(connectionDetails = connectionDetails, resultsDatabaseSchema
1: (function (connectionDetails, cdmDatabaseSchema, resultsDatabaseSchema = cd

R version:
R version 4.3.2 (2023-10-31)

Platform:
x86_64-pc-linux-gnu

Attached base packages:
- tools
- stats
- graphics
- grDevices
- utils
- datasets
- methods
- base

Other attached packages:
- Achilles (1.7.2)
- DatabaseConnector (6.3.1)

Output files:
errorReportR.txt (1020 Bytes)
log_achilles.txt (87.3 KB)
log_createIndices.txt (213 Bytes)
log_dropScratchTables.txt (84.2 KB)

Have you loaded the SqlRender package as well before the Achilles run?

Thanks Sanjay so much for taking the time to help! I’m so stuck :’)

I’ve tried importing SqlRender but am still getting the same nchars error as above. Of note, I’m using rpy2 to call achilles from python:

database_connector = rpackages.importr('DatabaseConnector')
sql_render = rpackages.importr('SqlRender')
achilles = rpackages.importr('Achilles')
connection_details = database_connector.createConnectionDetails(...)
achilles.achilles(connectionDetails=connection_details, ...)
t