{"record":{"id":"97c43d7910f17f68","repo":"JuliusBrussee/caveman","slug":"file-unsupported-or-missing-schema","errorCode":null,"errorMessage":"${file}: unsupported or missing $schema","messagePattern":"(.+?): unsupported or missing \\$schema","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-schemas.mjs","lineNumber":20,"sourceCode":"import { fileURLToPath } from \"node:url\";\nimport path from \"node:path\";\nimport Ajv2020 from \"ajv/dist/2020.js\";\n\nconst packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"..\");\nconst schemaRoot = path.join(packageRoot, \"schemas\");\nconst files = (await readdir(schemaRoot))\n  .filter((name) => name.endsWith(\".schema.json\"))\n  .sort();\n\nif (files.length === 0) {\n  throw new Error(\"no JSON schemas found\");\n}\n\nconst schemas = [];\nfor (const file of files) {\n  const schema = JSON.parse(await readFile(path.join(schemaRoot, file), \"utf8\"));\n  if (schema.$schema !== \"https://json-schema.org/draft/2020-12/schema\") {\n    throw new Error(`${file}: unsupported or missing $schema`);\n  }\n  if (typeof schema.$id !== \"string\" || schema.$id.length === 0) {\n    throw new Error(`${file}: missing $id`);\n  }\n  schemas.push(schema);\n}\n\nconst ajv = new Ajv2020({ allErrors: true, strict: true });\najv.addSchema(schemas);\nfor (const schema of schemas) {\n  const validate = ajv.getSchema(schema.$id);\n  if (!validate) throw new Error(`schema failed to compile: ${schema.$id}`);\n}\n\nconst agentFixtureRoot = path.join(packageRoot, \"fixtures\", \"agent\");\nconst fixtureFiles = (await readdir(agentFixtureRoot))\n  .filter((name) => name.endsWith(\".json\"))\n  .sort();","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/shared/contracts/scripts/validate-schemas.mjs#L2-L38","documentation":"Error \"${file}: unsupported or missing $schema\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/shared/contracts/scripts/validate-schemas.mjs:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set a supported $schema dialect in the schema file."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}