Skip to content
Latchkey

Newman "unable to read data from file" in CI

Newman tried to read a file argument (collection, environment, or data file) and could not. The path is resolved relative to the working directory of the step, which in CI is often not what you expect.

What this error means

newman exits with "unable to read data from file 'collection.json'" (or the environment/iteration file) and does not run any requests.

newman
error: unable to read data from file "postman/collection.json"
ENOENT: no such file or directory, open 'postman/collection.json'

Common causes

The path is wrong relative to the step working directory

CI runs from the repo root by default; a path that worked from a subfolder locally does not resolve the same way in the workflow step.

The file was not checked out or was in a different job

A collection generated in a prior job is not present unless uploaded and downloaded as an artifact, so Newman finds nothing at that path.

How to fix it

Point Newman at the correct path

  1. List the directory in the step to confirm the file is present.
  2. Use a path relative to the repo root, or set working-directory.
  3. Re-run so Newman reads the collection.
.github/workflows/ci.yml
- run: ls -la postman
- run: newman run postman/collection.json -e postman/env.json

Fetch generated collections from artifacts

If a previous job produced the collection, download it before the Newman step so the file exists on disk.

.github/workflows/ci.yml
- uses: actions/download-artifact@v4
  with:
    name: postman-collection

How to prevent it

  • Keep collection and environment files in the repo and reference them from root.
  • Add an ls check before the run step while debugging paths.
  • Use working-directory instead of fragile relative paths.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →