{"record":{"id":"3201de356797c3b8","repo":"Fission-AI/OpenSpec","slug":"invalid-dependency-reference-in-artifact-artifa","errorCode":null,"errorMessage":"Invalid dependency reference in artifact '${artifact.id}': '${req}' does not exist","messagePattern":"Invalid dependency reference in artifact '(.+?)': '(.+?)' does not exist","errorType":"exception","errorClass":"SchemaValidationError","httpStatus":null,"severity":"error","filePath":"src/core/artifact-graph/schema.ts","lineNumber":69,"sourceCode":"  const seen = new Set<string>();\n  for (const artifact of artifacts) {\n    if (seen.has(artifact.id)) {\n      throw new SchemaValidationError(`Duplicate artifact ID: ${artifact.id}`);\n    }\n    seen.add(artifact.id);\n  }\n}\n\n/**\n * Validates that all `requires` references point to valid artifact IDs.\n */\nfunction validateRequiresReferences(artifacts: Artifact[]): void {\n  const validIds = new Set(artifacts.map(a => a.id));\n\n  for (const artifact of artifacts) {\n    for (const req of artifact.requires) {\n      if (!validIds.has(req)) {\n        throw new SchemaValidationError(\n          `Invalid dependency reference in artifact '${artifact.id}': '${req}' does not exist`\n        );\n      }\n    }\n  }\n}\n\n/**\n * Validates that there are no cyclic dependencies.\n * Uses DFS to detect cycles and reports the full cycle path.\n */\nfunction validateNoCycles(artifacts: Artifact[]): void {\n  const artifactMap = new Map(artifacts.map(a => [a.id, a]));\n  const visited = new Set<string>();\n  const inStack = new Set<string>();\n  const parent = new Map<string, string>();\n\n  function dfs(id: string): string | null {","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/artifact-graph/schema.ts#L51-L87","documentation":"SchemaValidationError from validateRequiresReferences (invoked during parseSchema): an artifact's `requires` list names an id that no artifact in the schema defines. The schema YAML is internally inconsistent — a dependency points at a nonexistent artifact — so the schema cannot be loaded; the at-fault input is the bad `req` reference.","triggerScenarios":"Thrown at src/core/artifact-graph/schema.ts:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add an artifact with the missing id, or fix the typo in the requires entry","Remove the requires entry if the dependency no longer exists","Re-run validation to confirm all references resolve"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","contentChangedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}