{"record":{"id":"2f4bfeaf32790dc4","repo":"Fission-AI/OpenSpec","slug":"invalid-schema-errors","errorCode":null,"errorMessage":"Invalid schema: ${errors}","messagePattern":"Invalid schema: (.+?)","errorType":"exception","errorClass":"SchemaValidationError","httpStatus":null,"severity":"error","filePath":"src/core/artifact-graph/schema.ts","lineNumber":30,"sourceCode":"/**\n * Loads and validates an artifact schema from a YAML file.\n */\nexport function loadSchema(filePath: string): SchemaYaml {\n  const content = fs.readFileSync(filePath, 'utf-8');\n  return parseSchema(content);\n}\n\n/**\n * Parses and validates an artifact schema from YAML content.\n */\nexport function parseSchema(yamlContent: string): SchemaYaml {\n  const parsed = parseYaml(yamlContent);\n\n  // Validate with Zod\n  const result = SchemaYamlSchema.safeParse(parsed);\n  if (!result.success) {\n    const errors = result.error.issues.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');\n    throw new SchemaValidationError(`Invalid schema: ${errors}`);\n  }\n\n  const schema = result.data;\n\n  // Check for duplicate artifact IDs\n  validateNoDuplicateIds(schema.artifacts);\n\n  // Check that all requires references are valid\n  validateRequiresReferences(schema.artifacts);\n\n  // Check for cycles\n  validateNoCycles(schema.artifacts);\n\n  return schema;\n}\n\n/**\n * Validates that there are no duplicate artifact IDs.","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/artifact-graph/schema.ts#L12-L48","documentation":"Error \"Invalid schema: ${errors}\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/artifact-graph/schema.ts:30 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":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}