{"record":{"id":"840058fbdbd86fd9","repo":"can1357/oh-my-pi","slug":"unsupported-codex-security-coverage-document","errorCode":null,"errorMessage":"Unsupported Codex Security coverage document","messagePattern":"Unsupported Codex Security coverage document","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/security/importers/codex-security.ts","lineNumber":203,"sourceCode":"\treturn coverage;\n}\n\nexport async function importCodexSecurityBundle(\n\tbundleDirectory: string,\n\toptions: CodexSecurityImportOptions,\n): Promise<SecurityScanBundle> {\n\tconst root = path.resolve(bundleDirectory);\n\tconst manifest = await readJson<CodexManifest>(path.join(root, \"scan-manifest.json\"));\n\tconst findingsDocument = await readJson<CodexFindingsDocument>(path.join(root, \"findings.json\"));\n\tconst coverageDocument = await readJson<CodexCoverageDocument>(path.join(root, \"coverage.json\"));\n\tif (manifest.documentType !== \"codex-security.scan-manifest\" || manifest.schemaVersion !== \"1.0\") {\n\t\tthrow new Error(\"Unsupported Codex Security scan manifest\");\n\t}\n\tif (findingsDocument.documentType !== \"codex-security.findings\" || findingsDocument.schemaVersion !== \"1.0\") {\n\t\tthrow new Error(\"Unsupported Codex Security findings document\");\n\t}\n\tif (coverageDocument.documentType !== \"codex-security.coverage\" || coverageDocument.schemaVersion !== \"1.0\") {\n\t\tthrow new Error(\"Unsupported Codex Security coverage document\");\n\t}\n\tif (\n\t\t!manifest.scan?.id ||\n\t\tfindingsDocument.scanId !== manifest.scan.id ||\n\t\tcoverageDocument.scanId !== manifest.scan.id\n\t) {\n\t\tthrow new Error(\"Codex Security bundle scan IDs do not agree\");\n\t}\n\tconst fixtureProvenance = await readJson<CodexFixtureProvenance>(path.join(root, \"PROVENANCE.json\")).catch(\n\t\t(): CodexFixtureProvenance => ({}),\n\t);\n\tconst scanId = options.createScanId?.() ?? createSecurityScanId();\n\tconst createdAt = options.createdAt ?? manifest.scan.startedAt ?? new Date().toISOString();\n\tconst canonicalRoot = await fs.realpath(path.resolve(options.repositoryRoot));\n\tconst producer: SecurityProducer = {\n\t\tkind: \"codex-security-bundle\",\n\t\tname: manifest.scan.producer?.name || \"codex-security\",\n\t\tvendor: \"openai\",","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/security/importers/codex-security.ts#L185-L221","documentation":"The importer also validates coverage.json: it must declare documentType \"codex-security.coverage\" and schemaVersion \"1.0\". If not, the coverage document is unsupported and the whole bundle import fails.","triggerScenarios":"importCodexSecurityBundle reads coverage.json whose documentType or schemaVersion does not match codex-security.coverage / 1.0.","commonSituations":"Coverage file from a newer generator version; stale coverage.json left in the bundle directory from a previous run with a different format; files copied from mixed sources.","solutions":["Regenerate coverage.json so it declares documentType codex-security.coverage and schemaVersion 1.0","Rebuild the bundle from a single scan so all three documents share the same format generation","Confirm you are importing the correct directory and not one containing an older coverage.json"],"exampleFix":"// before (coverage.json)\n{ \"documentType\": \"coverage\", \"schemaVersion\": \"1.0\" }\n// after\n{ \"documentType\": \"codex-security.coverage\", \"schemaVersion\": \"1.0\" }","handlingStrategy":"validation","validationCode":"const coverage = JSON.parse(await Bun.file(path.join(dir, \"coverage.json\")).text());\nif (coverage.documentType !== \"codex-security.coverage\" || coverage.schemaVersion !== \"1.0\") {\n  throw new Error(`Unsupported coverage document: ${coverage.documentType}/${coverage.schemaVersion}`);\n}","typeGuard":"function isSupportedCoverage(d: unknown): d is { documentType: \"codex-security.coverage\"; schemaVersion: \"1.0\" } {\n  return typeof d === \"object\" && d !== null &&\n    (d as any).documentType === \"codex-security.coverage\" && (d as any).schemaVersion === \"1.0\";\n}","tryCatchPattern":"try {\n  const bundle = await importCodexSecurityBundle(dir);\n} catch (err) {\n  if (err instanceof Error && err.message === \"Unsupported Codex Security coverage document\") {\n    console.error(\"coverage.json envelope invalid — regenerate or clean the bundle directory\");\n  } else throw err;\n}","preventionTips":["Wipe stale coverage.json from bundle directories before re-running scans","Validate all bundle documents' envelopes right after generation","Generate the full bundle in one atomic step so formats stay consistent","Pin the generator version compatible with schema 1.0"],"tags":["codex-security","schema-validation","import","versioning"],"backgroundTag":"unsupported-schema-version","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}