Fission-AI/OpenSpec · error · SchemaValidationError

Duplicate artifact ID

Error message

Duplicate artifact ID: ${artifact.id}

What it means

Semantic validation in parseSchema found two artifacts declaring the same id. The duplicate id cited in the message breaks artifact resolution, so schema loading aborts even though YAML/Zod validation passed.

Solutions

  1. Search the schema for the duplicated id and rename one of the artifacts
  2. If the duplicate is intentional consolidation, merge their requires lists into a single artifact
  3. Re-run schema parsing to confirm ids are unique
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/artifact-graph/schema.ts:54 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/f3528dc50da7efa3. Report an issue: GitHub.

Appendix: source

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

  validateNoDuplicateIds(schema.artifacts);

  // Check that all requires references are valid
  validateRequiresReferences(schema.artifacts);

  // Check for cycles
  validateNoCycles(schema.artifacts);

  return schema;
}

/**
 * Validates that there are no duplicate artifact IDs.
 */
function validateNoDuplicateIds(artifacts: Artifact[]): void {
  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`
        );
      }

View on GitHub (pinned to 6926ccb18a)