Skip to content

fix(run): clarify purge info + hint --input/--input-file on stored-input validation failure#1257

Draft
DaveHanns wants to merge 1 commit into
apify:masterfrom
DaveHanns:fix/f59-preserve-input-honor-flags
Draft

fix(run): clarify purge info + hint --input/--input-file on stored-input validation failure#1257
DaveHanns wants to merge 1 commit into
apify:masterfrom
DaveHanns:fix/f59-preserve-input-honor-flags

Conversation

@DaveHanns

Copy link
Copy Markdown
Contributor

Summary

Two small wording tweaks in apify run so users (and, in particular, agents driving the CLI) don't waste turns re-running with different flags trying to figure out what happened.

Motivation

We repeatedly observed the following confusing flow when driving apify run in a project whose stored INPUT.json is missing a required field:

$ apify run
Info: All default local stores were purged.
Error: The input in your storage is invalid. Please fix the following errors:
  - Field productUrl is required

Two things are misleading here:

  1. The purge info message overstates what happened. purgeDefaultKeyValueStore already preserves the resolved input key (see the preserveRegExps branch in src/lib/utils.ts), so INPUT.json is NOT wiped by --purge. The current message reads as if it was, which pushes people to try --no-purge next (which yields the same validation error, because the file was never gone in the first place).

  2. The validation error offers no way out. Once the user has established the stored input is invalid, the natural next question is "how do I run it once with the missing field filled in?". The CLI does support this via --input '{...}' and --input-file ./input.json, and validateAndStoreInput writes the override to a temp key so the on-disk INPUT.json is not modified — but nothing in the error message points there.

Change

  • Clarify the purge info line to say the input key was preserved and point at --no-purge for full preservation.
  • Extend the "The input in your storage is invalid" error header to mention --input and --input-file as a way to override the stored input for this run.

Behavior is otherwise unchanged — messaging only, no logic edits.

Evidence (before)

Info: All default local stores were purged.
Error: The input in your storage is invalid. Please fix the following errors:
  - Field productUrl is required

Evidence (after)

Info: All default local stores were purged (the "INPUT" key-value store entry was preserved; pass --no-purge to keep everything).
Error: The input in your storage is invalid. Please fix the following errors (or override the stored input for this run with `--input '{"...":"..."}'` or `--input-file ./input.json`):
  - Field productUrl is required

Test plan

  • apify run on a project with a valid INPUT.json — no message change (both lines only appear on the failing path).
  • apify run on a project with an INPUT missing a required field — updated purge line + updated error header appear; INPUT.json on disk is untouched (already true today, this PR just tells the user that).
  • apify run --input '{"productUrl":"https://example.com"}' on the same project — override path still used; error header (if it were to appear) is the existing --input variant, not the storage variant.

Surfaced during an evaluation of Apify surfaces for agent-driven Actor development.

…put validation failure

Two small wording tweaks in `apify run` so users (and agents driving the
CLI) don't waste time re-running with different flags to figure out what
happened.

1. The `Info: All default local stores were purged.` message previously
   suggested that INPUT.json was also wiped. It isn't — `purgeDefaultKeyValueStore`
   preserves the resolved input key. The updated message says so
   explicitly and points at `--no-purge` for full preservation.

2. When there is no `--input` / `--input-file` override and the stored
   INPUT fails schema validation, the error only said "The input in your
   storage is invalid" with the field-required list. Users who wanted to
   supply the missing field on-the-fly had no idea `--input` / `--input-file`
   existed. The error now includes those flags in the header.

No behavior change — messaging only.

Surfaced during an evaluation of Apify surfaces for agent-driven Actor development.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@DaveHanns DaveHanns requested a review from l2ysho as a code owner July 4, 2026 22:54
@DaveHanns DaveHanns marked this pull request as draft July 5, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants