Fission-AI/OpenSpec · error · Error

Schema ' ' not found. Available schemas

Error message

Schema '${normalizedName}' not found. Available schemas: ${availableSchemas.join(', ')}

What it means

Thrown by resolveSchema after checking project-local, user override (XDG_DATA_HOME), and package built-in locations — none contained <name>/schema.yaml. Means the requested schema name (after normalization) is unknown; the message lists every schema that is available so the caller can correct the name.

Solutions

  1. Use one of the listed available schema names
  2. Create or install the schema before referencing it
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

 * 2. User override: ${XDG_DATA_HOME}/openspec/schemas/<name>/schema.yaml
 * 3. Package built-in: <package>/schemas/<name>/schema.yaml
 *
 * When projectRoot is not provided, only user override and package built-in are checked
 * (backward compatible behavior).
 *
 * @param name - Schema name (e.g., "spec-driven")
 * @param projectRoot - Optional project root directory for project-local schema resolution
 * @returns The resolved schema object
 * @throws Error if schema is not found in any location
 */
export function resolveSchema(name: string, projectRoot?: string): SchemaYaml {
  // Normalize name (remove .yaml extension if provided)
  const normalizedName = name.replace(/\.ya?ml$/, '');

  const schemaDir = getSchemaDir(normalizedName, projectRoot);
  if (!schemaDir) {
    const availableSchemas = listSchemas(projectRoot);
    throw new Error(
      `Schema '${normalizedName}' not found. Available schemas: ${availableSchemas.join(', ')}`
    );
  }

  const schemaPath = path.join(schemaDir, 'schema.yaml');

  // 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
    );
  }

View on GitHub (pinned to 6926ccb18a)