OHDSI Home | Forums | Wiki | Github

Error when running OHDSI Atlas study package

While running the Atlas R study package I have been encountering an error at the execute function while fetching the data from the server – (error executing sql: could not find function “chunk.default”).

Tried to search for an similar possible error in the forum but seems it is a new one.

How can i resolve this error? Thank you in advance
Please find the detailed error report in the below screenshot.


Did the study package include a renv.lock file? If so, did you use it? (was verifyDependencies = TRUE when calling execute()?)

No I study package does not include renv.lock file. Below is the code used in the execute() function.

execute(connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
cohortTable = cohortTable,
oracleTempSchema = oracleTempSchema,
outputFolder = outputFolder,
databaseId = databaseId,
databaseName = databaseName,
databaseDescription = databaseDescription,
createCohorts = TRUE,
synthesizePositiveControls = TRUE,
runAnalyses = TRUE,
runDiagnostics = TRUE,
packageResults = TRUE,
maxCores = 1)

Thank you for the quick response @schuemie

I recommend using an updated version of Hydra (that is the package your ATLAS instance is using to generate the study package). You can install the latest version of Hydra in R to use it with the specifications you created in ATLAS as described here.

Once you’ve regenerated the study package, you can use renv::init() (before building the package) to build the library with all the correct dependencies. I’m pretty sure that will solve the problems you’re experiencing right now.

Hello @schuemie, I have updated the Hydra package in R and regenerated a new study package. Also used renv::init() after building and installing the study package. But no luck with the error (could not find function “chunk.default”). I am attaching the log files and error report in the attachment below.

Hope this helps us find a solution to successfully run the study package.

I’m not sure what happened, but you do not appear to be using a study package generated by the latest version of Hydra, and do not appear to have renv initialized. The SQL error report you show indicates very old versions of packages required to run this study. For example, it lists CohortMethod 3.1.0 is currently installed, but the renv lock file specifies CohortMethod 4.2.2 to be able to run the study

If you were truly running a study package from the latest Hydra, it would throw an error saying you don’t have the right versions installed. And if you had successfully run renv::init(), that would have installed the correct versions.

You also seem to be on a very old R version (3.5.3). I recommend first upgrading R to a version greater than 4 (e.g. 4.2.1). Then install the latest version of Hydra. Then regenerate the study package. Then use renv::init().

1 Like