{"record":{"id":"ee0038e62ab8d88d","repo":"can1357/oh-my-pi","slug":"unknown-security-scan-scanid-ee0038","errorCode":null,"errorMessage":"Unknown security scan: ${scanId}","messagePattern":"Unknown security scan: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/security/store.ts","lineNumber":368,"sourceCode":"\t\t\t\ttarget: bundle.scan.target,\n\t\t\t});\n\t\t}\n\t\treturn summaries;\n\t}\n\n\tasync getFinding(scanId: string, findingId: string): Promise<SecurityFinding | null> {\n\t\tconst bundle = await this.getBundle(scanId);\n\t\treturn bundle?.findings.find(finding => finding.id === findingId) ?? null;\n\t}\n\n\tasync updateDisposition(\n\t\tscanId: string,\n\t\tfindingId: string,\n\t\tdisposition: SecurityDisposition,\n\t): Promise<SecurityFinding> {\n\t\treturn withSecurityStoreWrite(this.#projectDirectory, async () => {\n\t\t\tconst bundle = await this.#getBundleUnlocked(scanId);\n\t\t\tif (!bundle) throw new Error(`Unknown security scan: ${scanId}`);\n\t\t\tconst index = bundle.findings.findIndex(finding => finding.id === findingId);\n\t\t\tif (index < 0) throw new Error(`Unknown security finding: ${findingId}`);\n\t\t\tconst canonicalDisposition: SecurityDisposition = { status: disposition.status };\n\t\t\tif (disposition.rationale !== undefined) canonicalDisposition.rationale = disposition.rationale;\n\t\t\tif (disposition.updatedAt !== undefined) canonicalDisposition.updatedAt = disposition.updatedAt;\n\t\t\tif (disposition.actor !== undefined) canonicalDisposition.actor = disposition.actor;\n\t\t\tconst updated = { ...bundle.findings[index], disposition: canonicalDisposition };\n\t\t\tbundle.findings[index] = parseSecurityFinding(updated);\n\t\t\tif (bundle.sarif !== undefined) bundle.sarif = exportSecurityBundleToSarif(bundle);\n\t\t\tawait this.#putBundleUnlocked(bundle);\n\t\t\treturn bundle.findings[index];\n\t\t});\n\t}\n\n\tasync updateValidation(\n\t\tscanId: string,\n\t\tfindingId: string,\n\t\tvalidation: SecurityValidation,","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/security/store.ts#L350-L386","documentation":"updateDisposition() loads the full scan bundle; #getBundleUnlocked returns null when scans/<scanId>/scan.json does not exist (or the scan id fails the secscan_ format check). The method then throws this error because a disposition can only be recorded on an existing scan.","triggerScenarios":"Calling updateDisposition(scanId, findingId, disposition) with a scanId that has no stored scan.json — typo'd id, scan deleted from disk, wrong store (different repositoryRoot/stateRoot so a different project directory), or a malformed id not matching /^secscan_[a-zA-Z0-9]+$/.","commonSituations":"Storing scan ids from logs with surrounding whitespace/quotes; referencing a scan from a different repo's store after a checkout switch; the scans/<id>/ directory partially removed while index.json still lists it; case/character mistakes when copying ids.","solutions":["Verify the scan exists with await store.getScan(scanId) or store.listScans() and use a valid id before updating.","Confirm you opened the same store (same repositoryRoot/stateRoot) that wrote the scan — project directories are keyed per repo.","Check index.json scanIds to see whether the id was ever registered in this store.","If the scan directory was deleted, re-run the scan and putBundle() before attempting updates."],"exampleFix":"// before\nawait store.updateDisposition('secscan_9x', findingId, disposition); // typo'd id\n// after\nconst scan = await store.getScan('secscan_9x');\nif (scan) await store.updateDisposition(scan.id, findingId, disposition);","handlingStrategy":"type-guard","validationCode":"const scan = await store.getScan(scanId);\nif (!scan) throw new Error(`scan ${scanId} not found in ${store.projectDirectory}`);","typeGuard":"function isKnownScan(s: SecurityScan | null): s is SecurityScan {\n  return s !== null;\n}","tryCatchPattern":"try {\n  await store.updateDisposition(scanId, findingId, disposition);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Unknown security scan')) {\n    const scans = await store.listScans();\n    console.error(`scan ${scanId} not found; known: ${scans.map(s => s.id).join(', ')}`);\n  } else throw err;\n}","preventionTips":["Resolve scan ids from store.listScans() instead of copying them by hand.","Keep one SecurityStore per repository; don't mix ids across stores.","Trim/normalize ids coming from CLI args or config.","Check that cleanup jobs don't delete scans whose ids are still referenced."],"tags":["security-store","not-found","scan-id"],"backgroundTag":"resource-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}