{"record":{"id":"0d61ac73e2c125b9","repo":"can1357/oh-my-pi","slug":"label-is-required-for-this-action","errorCode":null,"errorMessage":"${label} is required for this action","messagePattern":"(.+?) is required for this action","errorType":"validation","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/security-scan.ts","lineNumber":86,"sourceCode":"\t\tcase \"working_tree\":\n\t\t\treturn { kind: \"working_tree\", ...common };\n\t\tcase \"ref_diff\":\n\t\t\tif (!params.base_revision || !params.head_revision) {\n\t\t\t\tthrow new ToolError(\"ref_diff preflight requires base_revision and head_revision\");\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tkind: \"ref_diff\",\n\t\t\t\tbaseRevision: params.base_revision,\n\t\t\t\theadRevision: params.head_revision,\n\t\t\t\t...common,\n\t\t\t};\n\t\tdefault:\n\t\t\treturn { kind: \"repository\", ...common };\n\t}\n}\n\nfunction requireValue(value: string | undefined, label: string): string {\n\tif (!value?.trim()) throw new ToolError(`${label} is required for this action`);\n\treturn value.trim();\n}\n\nfunction cloudClientForSession(session: ToolSession, credentialId?: number): CodexSecurityCloudClient {\n\tif (!session.authStorage) throw new ToolError(\"Codex Security cloud requires the authentication registry\");\n\tconst account = selectSecurityAccount(\n\t\tsession.authStorage,\n\t\t\"openai-codex\",\n\t\tcredentialId,\n\t\tsession.getSessionId?.() ?? undefined,\n\t);\n\treturn new CodexSecurityCloudClient({ authStorage: session.authStorage, account });\n}\n\nfunction textResult(text: string, details: SecurityScanToolDetails): AgentToolResult<SecurityScanToolDetails> {\n\treturn { content: [{ type: \"text\", text }], details };\n}\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/security-scan.ts#L68-L104","documentation":"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').","triggerScenarios":"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.","commonSituations":"Model references a scan it never started; scan id lost between tool calls; caller passes an empty string from an unset variable.","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"],"exampleFix":"// before\nsecurityScan({ action: \"stats\" });\n// after\nsecurityScan({ action: \"stats\", scan_id: capturedScanId });","handlingStrategy":"validation","validationCode":"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}`);","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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"],"tags":["validation","security-scan","parameters"],"backgroundTag":"missing-required-parameter","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}