can1357/oh-my-pi · error · ToolError
${label} is required for this action
Error message
${label} is required for this action What it means
requireValue is the generic guard for action-specific mandatory fields in the security-scan tool (operation, operationId, configuration, stats, bundle, scanId). When the requested action needs a value that is missing, empty, or whitespace-only, it throws ToolError('<label> is required for this action').
Source
Thrown at packages/coding-agent/src/tools/security-scan.ts:86
case "working_tree":
return { kind: "working_tree", ...common };
case "ref_diff":
if (!params.base_revision || !params.head_revision) {
throw new ToolError("ref_diff preflight requires base_revision and head_revision");
}
return {
kind: "ref_diff",
baseRevision: params.base_revision,
headRevision: params.head_revision,
...common,
};
default:
return { kind: "repository", ...common };
}
}
function requireValue(value: string | undefined, label: string): string {
if (!value?.trim()) throw new ToolError(`${label} is required for this action`);
return value.trim();
}
function cloudClientForSession(session: ToolSession, credentialId?: number): CodexSecurityCloudClient {
if (!session.authStorage) throw new ToolError("Codex Security cloud requires the authentication registry");
const account = selectSecurityAccount(
session.authStorage,
"openai-codex",
credentialId,
session.getSessionId?.() ?? undefined,
);
return new CodexSecurityCloudClient({ authStorage: session.authStorage, account });
}
function textResult(text: string, details: SecurityScanToolDetails): AgentToolResult<SecurityScanToolDetails> {
return { content: [{ type: "text", text }], details };
}
View on GitHub (pinned to 9690622007)
Solutions
- Capture the id returned when starting a scan/operation and pass it on follow-up calls
- Check the field name matches the label in the message (scanId vs scan_id)
- Verify the referenced scan/operation actually exists and hasn't expired
Example fix
// before
securityScan({ action: "stats" });
// after
securityScan({ action: "stats", scan_id: capturedScanId }); Defensive patterns
Strategy: validation
Validate before calling
const required = { stats: "scanId", result: "scanId", cancel: "scanId", configure: "configuration" }[action]; if (required && !params[required]?.trim?.()) throw new Error(`${required} is required for action ${action}`); Try / catch
try { await securityScan(params); } catch (e) { if (e instanceof ToolError && /is required for this action/.test(e.message)) { /* surface which field is missing to the caller/model and re-request */ } else throw e; } Prevention
- Persist scan/operation ids returned by the start call and reuse them
- Validate action-specific required fields before each call
- Avoid empty-string values from unset env variables — use undefined checks
When it happens
Trigger: Calling a security-scan action (e.g. status/cancel/result) without its required identifier — such as omitting scanId on a stats/result lookup, or operationId on an operation control call.
Common situations: Model references a scan it never started; scan id lost between tool calls; caller passes an empty string from an unset variable.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- scoped_path security scans require at least one include path
- symbol is required for project-aware ${action}; pass symbol=
- Symbol "${symbol}" occurrence ${occurrence} is out of bounds
- lookbackDays must be a positive integer or 'all'
- Security scan contains duplicate finding ids
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/0d61ac73e2c125b9.
Report an issue: GitHub.