{"record":{"id":"3c6cfe82b4df3c70","repo":"affaan-m/ECC","slug":"source-is-not-valid-json-error-message","errorCode":null,"errorMessage":"${source} is not valid JSON: ${error.message}","messagePattern":"(.+?) is not valid JSON: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ci/catalog.js","lineNumber":336,"sourceCode":"    }\n\n    expectations.push({\n      category: pattern.category,\n      mode: pattern.mode === 'minimum' && match[2] ? 'minimum' : pattern.mode,\n      expected: Number(match[1]),\n      source: `${pattern.source} (${pattern.category})`\n    });\n  }\n\n  return expectations;\n}\n\nfunction parseCatalogDescriptionExpectations(content, source, getDescription) {\n  let parsed;\n  try {\n    parsed = JSON.parse(content);\n  } catch (error) {\n    throw new Error(`${source} is not valid JSON: ${error.message}`);\n  }\n\n  const description = getDescription(parsed);\n  if (typeof description !== 'string') {\n    throw new Error(`${source} is missing the catalog count description`);\n  }\n\n  const match = description.match(/(\\d+)\\s+agents,\\s+(\\d+)\\s+skills,\\s+(\\d+)\\s+legacy command shims?/i);\n  if (!match) {\n    throw new Error(`${source} is missing the catalog count description`);\n  }\n\n  return [\n    { category: 'agents', mode: 'exact', expected: Number(match[1]), source },\n    { category: 'skills', mode: 'exact', expected: Number(match[2]), source },\n    { category: 'commands', mode: 'exact', expected: Number(match[3]), source },\n  ];\n}","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/ci/catalog.js#L318-L354","documentation":"parseCatalogDescriptionExpectations throws when a catalog source file (a JSON manifest, e.g. an install manifest or openai.yaml-derived JSON) fails JSON.parse. The faulting input is the file content at `source`; the underlying parse error message is appended, so this is a wrapper around malformed JSON rather than a semantic check failure.","triggerScenarios":"Thrown at scripts/ci/catalog.js:336 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the JSON syntax error reported after the colon (check trailing commas, unquoted keys, encoding).","Validate the file with a JSON linter or `node -e \"JSON.parse(...)\"` before rerunning.","Regenerate the manifest from its canonical source if it is produced by tooling."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}