Wrangler import error "Not currently importing anything"

For Workers & Pages, what is the name of the domain?

N/A

What is the error message?

Not currently importing anything

What is the issue or error you’re encountering

Importing data via wrangler d1 execute <db> --remote sometimes throws “Not currently importing anything”

What are the steps to reproduce the issue?

  1. Generate a file containing valid SQL queries (inserts, updates, and deletes)
  2. Run wrangler d1 execute <db> --remote --file=path/to/queries.sql (the more queries the more likely the error is to occur. I’m running between 50k and 200k queries per import)
  3. Observe wrangler uploading the file and executing the queries

Sometimes, for no apparent reason, wrangler exits with “ERROR: Not currently importing anything”. Inspecting the database shows that seemingly all queries have been executed successfully (wrangler reports so too). Re-running the same command with the same file executes them without any errors and running the file against a local copy of the DB works fine too. However, I run those imports via wrangler automatically and rely on wrangler’s exit code to determine whether the import was successful or not. So this error has been causing me a good amount of unnecessary re-imports.

I saw that the error is caught (and ignored) in this API example:

Unfortunately the error isn’t documented anywhere. Is this indeed safe to ignore? There doesn’t happen to be an option in wrangler to only ignore specific, uncritical errors, is there?

Thanks in advance!

A quick update based on what I observed: this error seems to occur more often when trying to import data during moderate load. Once the DB reaches ~20-60 queries per minute via workers, it’s virtually impossible to bulk-import data. Unfortunately those aborted imports still seem to count towards rows read/written, so a handful of aborted bulk imports can very easily increase costs.

The documentation says that D1 will not be responsive while bulk imports happen. This does not seem to be the case and instead the bulk import is aborted once the DB receives too many queries? I have yet to confirm if some or all data is still written to the DB or if it is rolled back entirely – some data seems to persist?

Are there any other approaches or strategies to regularly importing data?