feat: return input schema on start() invalid-input errors - #1275
Open
MQ37 wants to merge 7 commits into
Open
Conversation
MQ37
marked this pull request as draft
August 18, 2026 15:11
call-actor/call-actor-widget fell through to a generic 'verify the Actor name' message on a platform invalid-input 400 from start() — pointing the agent at the wrong problem. Branch that path: for a confirmed platform input-validation error, return the input-specific message and the Actor's input schema, not the Actor-name/existence hint. No extra network call — the schema was already fetched during resolveAndValidateActor. Discriminator: apify-core throws every start()-body validation failure (bad JSON, wrong type, real-schema mismatch) as ApifyApiError type 'invalid-input', status 400 — distinct from 'invalid-input-schema' (a broken schema on the Actor itself, not a user input problem). Written with AI assistance (Claude).
…ols too Direct per-Actor tools (actor_executor.ts) hit the same platform invalid-input 400 from actor.start() as call-actor, but errors there fell through to the fully generic tool-call error mapper — no schema, no input-specific message. Wrap just the start() call and intercept the confirmed platform-validation case; everything else rethrows unchanged, unaffected. Inline, not a shared helper with call_actor.ts: verified LOC — a shared module costs 17 more net lines and a new file to guard a duplication that's structurally capped at these two call sites (the only two places in this codebase that start() an Actor against user-supplied input).
Same AJV-vs-platform-schema explanation was written out at 3 call sites; kept it at its one canonical home (isActorInputValidationError's JSDoc), call sites now just point at it.
MQ37
force-pushed
the
feat/call-actor-input-error-schema
branch
from
August 19, 2026 07:26
05c7b1b to
87865c6
Compare
expect(spies.startInput).toBeUndefined() checked a variable the test's own apifyClient override never wires up — always undefined regardless of code behavior.
…ut-error-schema # Conflicts: # src/const.ts
Same respondUserError message array was duplicated in actor_executor.ts and call_actor.ts for the isActorInputValidationError branch. Single-source it next to isActorInputValidationError, mirroring the existing buildPermissionApprovalTexts/buildActorNotFoundHint pattern.
MQ37
marked this pull request as ready for review
August 20, 2026 09:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When
actor.start()is rejected by the platform with a confirmedinvalid-input400 (real-schema validation, not our own AJV copy),call-actor/call-actor-widgetand direct per-Actor tools now return the Actor's input schema and the platform's own message instead of falling through to the generic "verify the Actor name, input parameters, and ensure the Actor exists" text. No extra network call — the schema was already fetched duringresolveAndValidateActor(or already known at tools/list time for direct actor tools).Why
Split out from #1256 per review: a remote pre-flight validate-input call can't reduce failures (same validator either way), but the existing fallback message on a real start()-time input rejection points the agent at the wrong problem. This fixes just that response shape.
Direct actor tools (
actor_executor.ts) hit the same platform rejection via their ownactor.start()call but had no interception at all — extended after the initialcall-actorfix landed. Kept as independent inline logic in each of the two call sites rather than a shared helper: measured a shared module at +17 net lines to guard a duplication that's structurally capped at exactly these two places (the only two spots in this codebase thatstart()an Actor against user-supplied input).Testing
pnpm run type-check/lint/test:unit/format/check:agentsclean (93 files, 1361 passed, 1 skipped, zero regressions). Unit tests cover: schema+message returned (not the generic fallback) wheninputSchemais available, the platform message alone when it isn't, the direct-actor-tool executor delegating instead of throwing, any otherstart()error rethrown unchanged, and theisActorInputValidationErrorpredicate matching only the confirmed error type (not the siblinginvalid-input-schema).