{"record":{"id":"76c020cbe75e718e","repo":"can1357/oh-my-pi","slug":"unknown-security-finding-findingid-76c020","errorCode":null,"errorMessage":"Unknown security finding: ${findingId}","messagePattern":"Unknown security finding: (.+?)","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/security-scan.ts","lineNumber":258,"sourceCode":"\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\treturn textResult(\n\t\t\t\t\t`Imported ${bundle.findings.length} Codex Security cloud finding(s) as security scan ${bundle.scan.id}.`,\n\t\t\t\t\t{\n\t\t\t\t\t\taction: params.action,\n\t\t\t\t\t\timportedScan: { id: bundle.scan.id, findingCount: bundle.findings.length },\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase \"validate\": {\n\t\t\t\tconst scanId = requireValue(params.scan_id, \"scan_id\");\n\t\t\t\tconst findingId = requireValue(params.finding_id, \"finding_id\");\n\t\t\t\tconst status = params.validation_status;\n\t\t\t\tif (!status) throw new ToolError(\"validation_status is required for this action\");\n\t\t\t\tconst summary = requireValue(params.validation_summary, \"validation_summary\");\n\t\t\t\tconst store = await SecurityStore.openForCwd(this.session.cwd, { signal });\n\t\t\t\tconst finding = await store.getFinding(scanId, findingId);\n\t\t\t\tif (!finding) throw new ToolError(`Unknown security finding: ${findingId}`);\n\t\t\t\tconst evidence: SecurityEvidence[] = (params.validation_evidence ?? []).map((item, index) => ({\n\t\t\t\t\tid: createSecurityEvidenceId(\n\t\t\t\t\t\tfinding.fingerprint,\n\t\t\t\t\t\t`validation:${item.label}`,\n\t\t\t\t\t\tfinding.evidence.length + index,\n\t\t\t\t\t),\n\t\t\t\t\tkind: \"validation\",\n\t\t\t\t\tlabel: item.label,\n\t\t\t\t\texplanation: item.explanation,\n\t\t\t\t}));\n\t\t\t\tconst updated = await store.updateValidation(\n\t\t\t\t\tscanId,\n\t\t\t\t\tfindingId,\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus,\n\t\t\t\t\t\tsummary,\n\t\t\t\t\t\tevidenceIds: evidence.map(item => item.id),\n\t\t\t\t\t\tvalidatedAt: new Date().toISOString(),","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/security-scan.ts#L240-L276","documentation":"In the validate branch, after opening the SecurityStore for the session cwd, the tool looks up the finding by (scanId, findingId). If the store has no such finding, this ToolError is thrown before any validation update is written.","triggerScenarios":"action=\"validate\" with a finding_id that does not exist in the given scan_id — wrong scan id, finding already re-keyed after a re-scan, finding from an imported cloud scan stored under a different scan id, or querying a store from a different cwd than where the scan ran.","commonSituations":"Referencing findings after the scan was re-run (ids regenerate); validating a cloud-imported finding using the original cloud finding id instead of the imported id; running validate from a different repository directory.","solutions":["List the scan's findings (via the appropriate security_scan/store query) and use an exact finding_id from that scan.","Confirm scan_id matches the scan that produced the finding.","Run the tool with the same cwd used when the scan was created — SecurityStore.openForCwd is cwd-scoped.","If the scan was re-run, re-derive the finding id (fingerprints may map across runs)."],"exampleFix":"// before\n{ action: \"validate\", scan_id: \"scan-42\", finding_id: \"cloud-finding-9\", ... }\n// after\n{ action: \"validate\", scan_id: \"scan-42\", finding_id: \"finding-from-scan-42-listing\", ... }","handlingStrategy":"validation","validationCode":"const store = await SecurityStore.openForCwd(cwd);\nif (!(await store.getFinding(scanId, findingId))) throw new Error(`finding ${findingId} not in scan ${scanId}`);","typeGuard":null,"tryCatchPattern":"try { await tool.execute(id, validateParams); } catch (e) { if (e instanceof ToolError && e.message.startsWith(\"Unknown security finding\")) { /* refresh finding ids from the scan listing */ } throw e; }","preventionTips":["Fetch finding ids from the scan's own listing immediately before validating.","Run validate in the same working directory where the scan was created.","Re-derive ids after any re-scan instead of caching them."],"tags":["tooling","identifier","database"],"backgroundTag":"entity-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}