{"record":{"id":"4e28ca3eb4493cc6","repo":"langgenius/dify","slug":"invalid-api-openapi-spec-specpath","errorCode":null,"errorMessage":"Invalid API OpenAPI spec: ${specPath}","messagePattern":"Invalid API OpenAPI spec: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/contracts/openapi-ts.api.config.ts","lineNumber":140,"sourceCode":"  const segments = routeNamingSegments(operation.path).map((segment) =>\n    toCamelCase(segmentWords(segment)),\n  )\n\n  return [...(segments.length > 0 ? segments : ['root']), operation.method.toLowerCase()]\n}\n\nconst readApiSwagger = (filename: string): SwaggerDocument => {\n  const specPath = path.join(apiOpenApiDir, filename)\n\n  if (!fs.existsSync(specPath)) {\n    throw new Error(\n      `Missing API OpenAPI spec: ${specPath}. Run \"pnpm gen-api-openapi\" from packages/contracts/ first.`,\n    )\n  }\n\n  const rawSpec = JSON.parse(fs.readFileSync(specPath, 'utf8'))\n  if (!isObject(rawSpec) || !isObject(rawSpec.paths))\n    throw new Error(`Invalid API OpenAPI spec: ${specPath}`)\n\n  return rawSpec as SwaggerDocument\n}\n\nconst clone = <T>(value: T): T => {\n  return JSON.parse(JSON.stringify(value)) as T\n}\n\nconst componentSchemaRefPrefix = '#/components/schemas/'\n\nconst schemaNameFromRef = (ref: string) => {\n  if (ref.startsWith(componentSchemaRefPrefix)) return ref.slice(componentSchemaRefPrefix.length)\n  return undefined\n}\n\nconst getDocumentSchemas = (document: SwaggerDocument) => {\n  const components = (document.components ??= {})\n  return (components.schemas ??= {})","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/packages/contracts/openapi-ts.api.config.ts#L122-L158","documentation":"Error \"Invalid API OpenAPI spec: ${specPath}\" thrown in langgenius/dify.","triggerScenarios":"Thrown at packages/contracts/openapi-ts.api.config.ts:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}