{"record":{"id":"ad5b32321f2a5b1b","repo":"can1357/oh-my-pi","slug":"unknown-security-operation-operationid-ad5b32","errorCode":null,"errorMessage":"Unknown security operation: ${operationId}","messagePattern":"Unknown security operation: (.+?)","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/security-scan.ts","lineNumber":173,"sourceCode":"\t\t\t\t\t\t`Fingerprint: ${plan.fingerprint}.`,\n\t\t\t\t\t\t`Start it with action=start and plan_id=${plan.id}.`,\n\t\t\t\t\t].join(\" \"),\n\t\t\t\t\t{ action: params.action, plan: { id: plan.id, fingerprint: plan.fingerprint } },\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"start\": {\n\t\t\t\tconst operation = await coordinatorForSession().start({\n\t\t\t\t\tplanId: requireValue(params.plan_id, \"plan_id\"),\n\t\t\t\t});\n\t\t\t\treturn textResult(`Security scan ${operation.scanId} started as ${operation.operationId}.`, {\n\t\t\t\t\taction: params.action,\n\t\t\t\t\toperation,\n\t\t\t\t});\n\t\t\t}\n\t\t\tcase \"status\": {\n\t\t\t\tconst operationId = requireValue(params.operation_id, \"operation_id\");\n\t\t\t\tconst operation = await coordinatorForSession().status(operationId);\n\t\t\t\tif (!operation) throw new ToolError(`Unknown security operation: ${operationId}`);\n\t\t\t\treturn textResult(\n\t\t\t\t\t`Security scan ${operation.scanId}: ${operation.phase}; ${operation.findingCount} finding(s).`,\n\t\t\t\t\t{ action: params.action, operation },\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"cancel\": {\n\t\t\t\tconst operationId = requireValue(params.operation_id, \"operation_id\");\n\t\t\t\tconst cancelled = await coordinatorForSession().cancel(operationId);\n\t\t\t\treturn textResult(\n\t\t\t\t\tcancelled ? `Cancellation requested for ${operationId}.` : `No running operation ${operationId}.`,\n\t\t\t\t\t{\n\t\t\t\t\t\taction: params.action,\n\t\t\t\t\t\tcancelled,\n\t\t\t\t\t\toperation: (await coordinatorForSession().status(operationId)) ?? undefined,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"cloud_scans\": {","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/security-scan.ts#L155-L191","documentation":"When action=status, the tool requires operation_id, looks it up via the security coordinator, and throws this ToolError if the coordinator returns no snapshot — i.e. no operation exists with that id (or it is no longer tracked).","triggerScenarios":"security_scan with action=\"status\" and an operation_id that was never started, was started in a different cwd/session (different coordinator store), was already pruned, or contains a typo; also after a process restart if the operation was in-memory only.","commonSituations":"Copy-pasting an operation id from an earlier session or another repository; querying status after the scan finished and was cleaned up; mistaking a scanId for an operationId.","solutions":["Verify operation_id against the value returned when the scan was started (start returns 'Security scan <scanId> started as <operationId>').","Run the status check from the same working directory/session where the scan was started.","Re-run action=start with the original plan_id if the operation no longer exists, then poll the new operation_id.","Check for typos or stale ids from earlier runs."],"exampleFix":"// before\nawait tool.execute(id, { action: \"status\", operation_id: oldScanId });\n// after\nawait tool.execute(id, { action: \"status\", operation_id: operationIdFromStartResult });","handlingStrategy":"validation","validationCode":"// keep the operationId returned by action=start and verify before polling\nconst known = new Set<string>(); // add ids from start results\nif (!known.has(operationId)) throw new Error(`no local record of operation ${operationId}`);","typeGuard":null,"tryCatchPattern":"try { return await tool.execute(id, { action: \"status\", operation_id }); } catch (e) { if (e instanceof ToolError && e.message.startsWith(\"Unknown security operation\")) { return null; /* treat as expired */ } throw e; }","preventionTips":["Store the operationId returned by start and use exactly that for status/cancel.","Poll from the same cwd/session the scan was started in.","Handle finished/expired operations gracefully instead of reusing stale ids."],"tags":["tooling","identifier","state"],"backgroundTag":"unknown-identifier","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}