Fission-AI/OpenSpec · error · SchemaLoadError

Invalid schema at

Error message

Invalid schema at '${schemaPath}': ${err.message}

What it means

The schema YAML was read successfully but failed structural validation: parseSchema raised a SchemaValidationError (Zod issues), which is re-wrapped as a SchemaLoadError with the offending path and the original error as cause.

Solutions

  1. Open the schema file at the reported path and fix the validation issues listed in the message
  2. Compare the file against the expected artifact schema shape (artifacts with id, requires, etc.)
  3. Validate the YAML syntax first, then re-run to confirm the structural errors are resolved
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/core/artifact-graph/resolver.ts:213 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/69df8a8e49a31d90. Report an issue: GitHub.

Appendix: source

Thrown at src/core/artifact-graph/resolver.ts:213

  // Load and parse the schema
  let content: string;
  try {
    content = fs.readFileSync(schemaPath, 'utf-8');
  } catch (err) {
    const ioError = err instanceof Error ? err : new Error(String(err));
    throw new SchemaLoadError(
      `Failed to read schema at '${schemaPath}': ${ioError.message}`,
      schemaPath,
      ioError
    );
  }

  try {
    return parseSchema(content);
  } catch (err) {
    if (err instanceof SchemaValidationError) {
      throw new SchemaLoadError(
        `Invalid schema at '${schemaPath}': ${err.message}`,
        schemaPath,
        err
      );
    }
    const parseError = err instanceof Error ? err : new Error(String(err));
    throw new SchemaLoadError(
      `Failed to parse schema at '${schemaPath}': ${parseError.message}`,
      schemaPath,
      parseError
    );
  }
}

/**
 * Lists all available schema names.
 * Combines project-local, user override, and package built-in schemas.
 *

View on GitHub (pinned to 6926ccb18a)