Skip to content

apify run: ENOENT error for INPUT.json after successful Actor exit when using default purge #975

@howsun7

Description

@howsun7

Description

When running apify run (without flags), the CLI exits with an error even though the Actor completes successfully:

[apify] INFO  Exiting Actor ({"exit_code": 0})
Error: ENOENT: no such file or directory, stat '/path/to/project/storage/key_value_stores/default/INPUT.json'

Steps to Reproduce

  1. Create a new Python Actor: apify create my-actor (select Python + Playwright template)
  2. Create storage/key_value_stores/default/INPUT.json with valid input
  3. Run apify run
  4. Actor runs successfully (exit_code: 0)
  5. CLI crashes with ENOENT error trying to read INPUT.json

Expected Behavior

The CLI should either:

  1. Not delete INPUT.json during the default purge operation, OR
  2. Not attempt to read INPUT.json after the Actor exits if it was purged

Actual Behavior

The --purge behavior (which is default) deletes the entire key-value store including INPUT.json. After the Actor successfully exits, the CLI attempts to read INPUT.json and fails with ENOENT.

Workarounds

  • Use apify run --no-purge
  • Use apify run --input '{"key": "value"}' to pass input via CLI flag

Environment

  • apify-cli version: 1.1.1
  • OS: macOS (darwin-arm64)
  • Node.js: v25.2.1

Additional Context

The Actor code handles missing input gracefully (await Actor.get_input() or {}), so the Actor itself runs fine. The error is purely in the CLI layer after the Actor completes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-toolingIssues with this label are in the ownership of the tooling team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions