JuliusBrussee/caveman · error · Error
no JSON schemas found
Error message
no JSON schemas found
What it means
This schema validation script reads packages/shared/contracts/schemas and expects at least one *.schema.json file. If the directory is empty or the filter matches nothing, it throws 'no JSON schemas found' because validating zero schemas would silently pass. It is a sanity gate on the schema package's contents.
Solutions
- Verify packages/shared/contracts/schemas exists and contains *.schema.json files
- Rename schemas to use the .schema.json extension
- Fix any .gitignore rule or copy step that excludes schema files from the checkout/package
- Check that packageRoot resolution in the script points at the contracts package directory
Example fix
// before schemas/ adapter-conformance.json // after schemas/ adapter-conformance.schema.json
Defensive patterns
Strategy: validation
Validate before calling
import { readdir } from 'node:fs/promises';
const files = (await readdir(schemaRoot)).filter(n => n.endsWith('.schema.json'));
if (files.length === 0) throw new Error(`no schemas at ${schemaRoot}; check checkout and .gitignore`); Try / catch
try { await runSchemaValidation(); } catch (e) { if (e.message === 'no JSON schemas found') { console.error(`Schemas missing at ${schemaRoot}`); process.exitCode = 1; } else throw e; } Prevention
- Keep the .schema.json extension convention documented in CONTRIBUTING
- Check .gitignore for patterns that would exclude schemas/
- Verify the schemas directory exists after fresh clone before running validation
When it happens
Trigger: Running scripts/validate-schemas.mjs when packages/shared/contracts/schemas contains no files ending in .schema.json (empty dir, renamed files, wrong extension like .json only, or schemaRoot pointing at the wrong path).
Common situations: Schemas renamed from foo.schema.json to foo.json; schemas moved to another directory without updating the script; fresh checkout where schema files were gitignored by an over-broad .gitignore rule.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- expected exactly 2 agent conformance fixtures, found
- repository intelligence: cwd is not a directory
- adapter conformance schema failed to compile
- apiKey, baseURL, and agent are required
- arm must be or
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/4f2c37beed8c90ae.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shared/contracts/scripts/validate-schemas.mjs:13
import { readdir, readFile } from "node:fs/promises";
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);View on GitHub (pinned to 3ee70a1026)