Fission-AI/OpenSpec · error · TemplateLoadError

Schema ' ' not found

Error message

Schema '${schemaName}' not found

What it means

TemplateLoadError raised by loadTemplate when getSchemaDir cannot resolve the requested schema name (e.g. "spec-driven") to a directory — the schema is not project-local, user-installed, or built-in. The template cannot be loaded because its parent schema does not exist; input at fault is the schemaName argument.

Solutions

  1. Verify the schema name and that it is installed/available
  2. List available schemas and use a valid name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/artifact-graph/instruction-loader.ts:214 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/e402d42f61e613bd. Report an issue: GitHub.

Appendix: source

Thrown at src/core/artifact-graph/instruction-loader.ts:214

}

/**
 * Loads a template from a schema's templates directory.
 *
 * @param schemaName - Schema name (e.g., "spec-driven")
 * @param templatePath - Relative path within the templates directory (e.g., "proposal.md")
 * @param projectRoot - Optional project root for project-local schema resolution
 * @returns The template content
 * @throws TemplateLoadError if the template cannot be loaded
 */
export function loadTemplate(
  schemaName: string,
  templatePath: string,
  projectRoot?: string
): string {
  const schemaDir = getSchemaDir(schemaName, projectRoot);
  if (!schemaDir) {
    throw new TemplateLoadError(
      `Schema '${schemaName}' not found`,
      templatePath
    );
  }

  const templatesDir = path.join(schemaDir, 'templates');
  const templatePathOnDisk = path.join(templatesDir, templatePath);

  try {
    FileSystemUtils.assertPathWithin(templatesDir, templatePathOnDisk);
  } catch (error) {
    throw new TemplateLoadError(
      error instanceof Error ? error.message : String(error),
      templatePathOnDisk
    );
  }

  if (!fs.existsSync(templatePathOnDisk)) {

View on GitHub (pinned to 6926ccb18a)