From c4efc81f1ff8715d61a4ba3b435174276703baac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Sol=C3=A1r?= Date: Mon, 9 Nov 2026 14:35:41 +0100 Subject: [PATCH] fix: make the Actor context fallback error generic and actionable The generic fallback in resolveActorContext said "Unable to detect what Actor to create a build for" for every caller, so `apify runs ls` and `apify builds ls` blamed builds. It now names no operation and points at both ways out. The four callers appended their own recovery hint, which duplicated the new copy and gave wrong advice on the "not found" branches, so it is gone. Co-Authored-By: Claude Opus 5 --- src/commands/actors/info.ts | 2 +- src/commands/builds/create.ts | 2 +- src/commands/builds/ls.ts | 2 +- src/commands/runs/ls.ts | 2 +- src/lib/commands/resolve-actor-context.ts | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/commands/actors/info.ts b/src/commands/actors/info.ts index 99d025801..2ab6f068a 100644 --- a/src/commands/actors/info.ts +++ b/src/commands/actors/info.ts @@ -108,7 +108,7 @@ export class ActorsInfoCommand extends ApifyCommand { if (!ctx.valid) { error({ - message: `${ctx.reason}. Please specify the Actor ID.`, + message: `${ctx.reason}.`, stdout: true, }); diff --git a/src/commands/builds/create.ts b/src/commands/builds/create.ts index 6a408b53f..82f105274 100644 --- a/src/commands/builds/create.ts +++ b/src/commands/builds/create.ts @@ -87,7 +87,7 @@ export class BuildsCreateCommand extends ApifyCommand { if (!ctx.valid) { error({ - message: `${ctx.reason}. Please run this command in an Actor directory, or specify the Actor ID.`, + message: `${ctx.reason}.`, stdout: true, }); diff --git a/src/commands/runs/ls.ts b/src/commands/runs/ls.ts index 0fbfe16c2..56ef7e42f 100644 --- a/src/commands/runs/ls.ts +++ b/src/commands/runs/ls.ts @@ -89,7 +89,7 @@ export class RunsLsCommand extends ApifyCommand { if (!ctx.valid) { error({ - message: `${ctx.reason}. Please run this command in an Actor directory, or specify the Actor ID.`, + message: `${ctx.reason}.`, }); return; diff --git a/src/lib/commands/resolve-actor-context.ts b/src/lib/commands/resolve-actor-context.ts index bc0ed27c7..d293a4f7d 100644 --- a/src/lib/commands/resolve-actor-context.ts +++ b/src/lib/commands/resolve-actor-context.ts @@ -85,6 +85,7 @@ export async function resolveActorContext({ return { valid: false as const, - reason: 'Unable to detect what Actor to create a build for', + reason: + 'No Actor specified. Pass an Actor ID or "username/name", or run this command from an Actor project directory', }; }