Fission-AI/OpenSpec · error · SchemaValidationError

Invalid dependency reference in artifact

Error message

Invalid dependency reference in artifact '${artifact.id}': '${req}' does not exist

What it means

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.

Solutions

  1. Add an artifact with the missing id, or fix the typo in the requires entry
  2. Remove the requires entry if the dependency no longer exists
  3. Re-run validation to confirm all references resolve
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/artifact-graph/schema.ts:69 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/3201de356797c3b8. Report an issue: GitHub.

Appendix: source

Thrown at src/core/artifact-graph/schema.ts:69

  const seen = new Set<string>();
  for (const artifact of artifacts) {
    if (seen.has(artifact.id)) {
      throw new SchemaValidationError(`Duplicate artifact ID: ${artifact.id}`);
    }
    seen.add(artifact.id);
  }
}

/**
 * Validates that all `requires` references point to valid artifact IDs.
 */
function validateRequiresReferences(artifacts: Artifact[]): void {
  const validIds = new Set(artifacts.map(a => a.id));

  for (const artifact of artifacts) {
    for (const req of artifact.requires) {
      if (!validIds.has(req)) {
        throw new SchemaValidationError(
          `Invalid dependency reference in artifact '${artifact.id}': '${req}' does not exist`
        );
      }
    }
  }
}

/**
 * Validates that there are no cyclic dependencies.
 * Uses DFS to detect cycles and reports the full cycle path.
 */
function validateNoCycles(artifacts: Artifact[]): void {
  const artifactMap = new Map(artifacts.map(a => [a.id, a]));
  const visited = new Set<string>();
  const inStack = new Set<string>();
  const parent = new Map<string, string>();

  function dfs(id: string): string | null {

View on GitHub (pinned to 6926ccb18a)