OHDSI Home | Forums | Wiki | Github

Error in jsonlite::fromJSON(file = treemapFile) : argument "txt" is missing, with no default

we got this issue when trying to generate json file using Achilles::exportToJson.
the error : Generating condition reports
Error in jsonlite::fromJSON(file = treemapFile) :
argument “txt” is missing, with no default
is there any solution or some guides how to fix it.

1 Like

Hi Mohammad,
I’ve the same error, hope that someone could help, this is the detail of the command:

cdmDatabaseSchema = "cdm_XXX", 
resultsDatabaseSchema = "results_XXX",
outputPath = "/opt/OHDSI/Achilles", 
vocabDatabaseSchema = "cdm_XXX", 
compressIntoOneFile = TRUE)
1 Like

I am also having the same issue.

Encountered the same issue and did some research. That function from the jsonlite package in the error massage never actually had a ‘file’ argument so this is not some standard scenario of incompatible package versions.
As far as I can tell any version of Achiles released since April this year - and thus as far as I can tell also every version archived on cran - just has a exportToJson function that is broken independently of any package management.
What changed in April is that they switched from another json package to jsonlite without apparently adjusting any code except package names. Might even have been a simple search-and-replace.
There is has been a pull request on git for a while that seems to fix the issue, though, so it should not be too long until they release working versions of Achilles again.

Could you provide the link to PR? Maybe we can get it bumped

It’s this one Fix fromJSON correct method usage by ziporah · Pull Request #743 · OHDSI/Achilles · GitHub

Managed to find a workaround for anyone who cannot wait for a fixed version, but it is really dumb and clumsy.
You need to explicitly load the jsonlite package, then call trace(fromJSON, edit=TRUE) and then an editor window pops up where you can manually mess with that innocent function in just the right way to make it adjust for the sins of the Achilles package.
This is what worked for me, but it is the result of trial and error and is guaranteed to have unneccessary changes: {
dots = list(…)
if (!hasArg(txt)) {
txt = as.character(dots$file)
dots$file = NULL
if (is.character(txt) && length(txt) == 1 && nchar(txt,
type = “bytes”) < 2084 && !validate(txt)) {
if (grepl("^https?://", txt, useBytes = TRUE)) {
txt ← if (R.version$major < 4) {
else {
base::url(txt, headers = c(Accept = “application/json, text/*, /”))
else if (file.exists(txt)) {
txt ← file(txt)
parse_and_simplify(txt = txt, simplifyVector = simplifyVector,
simplifyDataFrame = simplifyDataFrame, simplifyMatrix = simplifyMatrix,
flatten = flatten)

I’ve requested the review on the PR, and I think you’re right that the source of the issue comes form moving from RJSONIO to jsonlite, but there were places where the functions weren’t updated to use the different API.

Encountered the same error. Hope to see it updated soon :slight_smile:

I’ve tagged the PR with this thread and hopefully that will get action on this item.