Skip to content

Download fails with invalid curl timeout option during FAERS zip download #25

Description

@InfiniteStryker0

I’m using it to build a FAERS 2016–2025 dataset and ran into an issue during the package-native zip download step. This is on Windows 11, x86_64-w64-mingw32, RStudio 2026.05.0 Build 218, and R version 4.4.2.

When calling faers::faers() to download/parse a quarterly FAERS ASCII file, the function begins the download but then fails inside the curl download layer.

Example quarter:

obj <- faers::faers(
    year = 2016,
    quarter = 1,
    dir = download_dir,
    compress_dir = q_compress_dir
)

Console output:

========================================
Downloading/parsing FAERS 2016Q1
========================================
Downloading 1 file from:
<https://fis.fda.gov/content/Exports/faers_ascii_2016q1.zip>
Warning in handle_setopt(handle, ..., noprogress = TRUE) :
  NAs introduced by coercion to integer range
Error in handle_setopt(handle, ..., noprogress = TRUE) : 
  Invalid or unsupported value when setting curl option 'timeout'

I initially suspected this was caused by setting a very large or non-finite R timeout option, but the error persisted even after explicitly setting a finite timeout, for example:

options(timeout = 7200L)

and also with smaller values such as:

options(timeout = 600L)

The issue appears to occur before parsing, during the zip file download step.

A workaround is to manually download the zip file with utils::download.file() and then pass the local file to faers::faers_parse():

zip_url <- "https://fis.fda.gov/content/Exports/faers_ascii_2016q1.zip"

zip_file <- file.path(
    download_dir,
    "faers_ascii_2016q1.zip"
)

utils::download.file(
    url = zip_url,
    destfile = zip_file,
    mode = "wb",
    method = "libcurl"
)

obj <- faers::faers_parse(
    path = zip_file,
    year = 2016,
    quarter = 1,
    compress_dir = q_compress_dir
)

This bypasses the download error and allows parsing to proceed.

Would it be possible to check how the package’s download helper is passing the timeout option to curl::handle_setopt()? It seems like an invalid value may be reaching curl internally, even when getOption("timeout") is finite. A few possible improvements might be:

  • sanitize/coerce the timeout value before passing it to curl;
  • default to a modest finite timeout if getOption("timeout") is missing or invalid;
  • expose a user-facing timeout argument in faers() / faers_download();
  • allow faers() to skip downloading when a local zip file already exists;
  • document the recommended workaround of using faers_parse(path = local_zip).

Thanks — happy to provide session info or a minimal reproducible example if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions