JuliusBrussee/caveman · error · Error

${file}: unsupported or missing $schema

Error message

${file}: unsupported or missing $schema

What it means

Error "${file}: unsupported or missing $schema" thrown in JuliusBrussee/caveman.

Source

Thrown at packages/shared/contracts/scripts/validate-schemas.mjs:20

import { fileURLToPath } from "node:url";
import path from "node:path";
import Ajv2020 from "ajv/dist/2020.js";

const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const schemaRoot = path.join(packageRoot, "schemas");
const files = (await readdir(schemaRoot))
  .filter((name) => name.endsWith(".schema.json"))
  .sort();

if (files.length === 0) {
  throw new Error("no JSON schemas found");
}

const schemas = [];
for (const file of files) {
  const schema = JSON.parse(await readFile(path.join(schemaRoot, file), "utf8"));
  if (schema.$schema !== "https://json-schema.org/draft/2020-12/schema") {
    throw new Error(`${file}: unsupported or missing $schema`);
  }
  if (typeof schema.$id !== "string" || schema.$id.length === 0) {
    throw new Error(`${file}: missing $id`);
  }
  schemas.push(schema);
}

const ajv = new Ajv2020({ allErrors: true, strict: true });
ajv.addSchema(schemas);
for (const schema of schemas) {
  const validate = ajv.getSchema(schema.$id);
  if (!validate) throw new Error(`schema failed to compile: ${schema.$id}`);
}

const agentFixtureRoot = path.join(packageRoot, "fixtures", "agent");
const fixtureFiles = (await readdir(agentFixtureRoot))
  .filter((name) => name.endsWith(".json"))
  .sort();

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Set a supported $schema dialect in the schema file.

When it happens

Trigger: Thrown at packages/shared/contracts/scripts/validate-schemas.mjs:20 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/97c43d7910f17f68. Report an issue: GitHub.