{"record":{"id":"9f20210348ece981","repo":"can1357/oh-my-pi","slug":"security-scan-scanid-has-no-report-9f2021","errorCode":null,"errorMessage":"Security scan ${scanId} has no report","messagePattern":"Security scan (.+?) has no report","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/slash-commands/helpers/security.ts","lineNumber":200,"sourceCode":"\t\tif (token === \"--output\") outputPath = requireToken(tokens, ++index, token);\n\t\telse if (token === \"--format\") {\n\t\t\tconst value = requireToken(tokens, ++index, token);\n\t\t\tif (value !== \"bundle\" && value !== \"sarif\" && value !== \"report\") {\n\t\t\t\tthrow new Error(`Unknown export format: ${value}`);\n\t\t\t}\n\t\t\tformat = value;\n\t\t} else throw new Error(`Unknown export option: ${token}`);\n\t}\n\tif (!outputPath) throw new Error(\"export requires --output <path>\");\n\tconst store = await SecurityStore.openForCwd(runtime.cwd);\n\tconst bundle = await store.getBundle(scanIdFromInput(scanId));\n\tif (!bundle) throw new Error(`Unknown security scan: ${scanId}`);\n\tlet content: string;\n\tif (format === \"sarif\") {\n\t\tif (!bundle.sarif) throw new Error(`Security scan ${scanId} has no SARIF result`);\n\t\tcontent = `${JSON.stringify(bundle.sarif, null, 2)}\\n`;\n\t} else if (format === \"report\") {\n\t\tif (bundle.report === undefined) throw new Error(`Security scan ${scanId} has no report`);\n\t\tcontent = bundle.report;\n\t} else {\n\t\tcontent = `${JSON.stringify(bundle, null, 2)}\\n`;\n\t}\n\tconst absolute = path.resolve(runtime.cwd, outputPath);\n\tawait writeSecurityFileAtomic(absolute, content, { hardenParent: false });\n\tawait runtime.output(`Exported security scan ${scanId} to ${shortenPath(absolute)}.`);\n}\n\ninterface CloudCliOptions {\n\tcredentialId?: number;\n\tconfigurationId?: string;\n\trepositoryId?: string;\n\trepositoryUrl?: string;\n\tenvironmentId?: string;\n\tlookbackDays?: number | \"all\";\n}\n","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/slash-commands/helpers/security.ts#L182-L218","documentation":"The requested export format is report, but the stored scan bundle has no report (bundle.report === undefined). Reports are generated only for scans that produced one (e.g. SARIF imports with report generation); other scans store findings without a rendered report, so the requested format is unavailable for that scan id.","triggerScenarios":"Running /security export <scan-id> --output <path> --format report on a scan whose bundle has report === undefined; exporting a scan imported from a source that does not generate reports; a scan imported before report generation was part of the pipeline.","commonSituations":"Assuming every scan has an accompanying markdown/HTML report; exporting older scans after upgrading; mixing up report availability between SARIF-file imports and Codex bundle imports.","solutions":["Export as bundle (--format bundle) to get the full stored scan data instead","Re-import the source (e.g. /security import results.sarif) so a report is generated, then export the new scan as report","Use --format sarif if the scan retains SARIF and you need machine-readable output"],"exampleFix":"// before\n/security export scan-abc --output report.md --format report\n// after (scan has no stored report)\n/security export scan-abc --output bundle.json --format bundle","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await runSlashCommand(`/security export ${scanId} --output report.md --format report`);\n} catch (err) {\n  if (err instanceof Error && err.message.endsWith(\"has no report\")) {\n    // fall back to the raw bundle instead\n    await runSlashCommand(`/security export ${scanId} --output bundle.json --format bundle`);\n  } else throw err;\n}","preventionTips":["Export --format report only for scans known to have generated a report (typically SARIF imports)","Use --format bundle when report availability is uncertain","Re-import the source to regenerate a report before exporting as report","Treat report as an optional view, not a guaranteed artifact of every scan"],"tags":["cli","missing-data","slash-command"],"backgroundTag":"resource-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}