{"record":{"id":"48ec8bea97050170","repo":"openai/codex","slug":"outputschema-must-be-a-plain-json-object","errorCode":null,"errorMessage":"outputSchema must be a plain JSON object","messagePattern":"outputSchema must be a plain JSON object","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdk/typescript/src/outputSchemaFile.ts","lineNumber":16,"sourceCode":"import { promises as fs } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nexport type OutputSchemaFile = {\n  schemaPath?: string;\n  cleanup: () => Promise<void>;\n};\n\nexport async function createOutputSchemaFile(schema: unknown): Promise<OutputSchemaFile> {\n  if (schema === undefined) {\n    return { cleanup: async () => {} };\n  }\n\n  if (!isJsonObject(schema)) {\n    throw new Error(\"outputSchema must be a plain JSON object\");\n  }\n\n  const schemaDir = await fs.mkdtemp(path.join(os.tmpdir(), \"codex-output-schema-\"));\n  const schemaPath = path.join(schemaDir, \"schema.json\");\n  const cleanup = async () => {\n    try {\n      await fs.rm(schemaDir, { recursive: true, force: true });\n    } catch {\n      // suppress\n    }\n  };\n\n  try {\n    await fs.writeFile(schemaPath, JSON.stringify(schema), \"utf8\");\n    return { schemaPath, cleanup };\n  } catch (error) {\n    await cleanup();\n    throw error;","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/sdk/typescript/src/outputSchemaFile.ts#L1-L34","documentation":"Error \"outputSchema must be a plain JSON object\" thrown in openai/codex.","triggerScenarios":"Thrown at sdk/typescript/src/outputSchemaFile.ts:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass outputSchema as a plain JSON object rather than an array or primitive."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}