affaan-m/ECC · error · Error
${source} is not valid JSON: ${error.message}
Error message
${source} is not valid JSON: ${error.message} What it means
`parseCatalogDescriptionExpectations` reads `.claude-plugin/plugin.json` (source = `.claude-plugin/plugin.json description`, getDescription = `parsed => parsed.description`) or `.claude-plugin/marketplace.json` (source = `.claude-plugin/marketplace.json plugin description`, getDescription = `parsed => parsed.plugins?.[0]?.description`). It first JSON-parses the file; a parse failure throws `${source} is not valid JSON: <error.message>`. This is a structural JSON error in the plugin manifest, not a count-mismatch.
Source
Thrown at scripts/ci/catalog.js:336
}
expectations.push({
category: pattern.category,
mode: pattern.mode === 'minimum' && match[2] ? 'minimum' : pattern.mode,
expected: Number(match[1]),
source: `${pattern.source} (${pattern.category})`
});
}
return expectations;
}
function parseCatalogDescriptionExpectations(content, source, getDescription) {
let parsed;
try {
parsed = JSON.parse(content);
} catch (error) {
throw new Error(`${source} is not valid JSON: ${error.message}`);
}
const description = getDescription(parsed);
if (typeof description !== 'string') {
throw new Error(`${source} is missing the catalog count description`);
}
const match = description.match(/(\d+)\s+agents,\s+(\d+)\s+skills,\s+(\d+)\s+legacy command shims?/i);
if (!match) {
throw new Error(`${source} is missing the catalog count description`);
}
return [
{ category: 'agents', mode: 'exact', expected: Number(match[1]), source },
{ category: 'skills', mode: 'exact', expected: Number(match[2]), source },
{ category: 'commands', mode: 'exact', expected: Number(match[3]), source },
];
}View on GitHub (pinned to 01e15490f0)
Solutions
- Run `node -e "JSON.parse(require('fs').readFileSync('.claude-plugin/plugin.json','utf8'))"` (and the marketplace.json equivalent) to surface the exact parse error and line.
- Fix the JSON syntax error — remove trailing commas, quote all keys, remove comments, escape control characters.
- Validate with `npx jsonlint .claude-plugin/plugin.json` or a JSON schema validator.
- Re-run `node scripts/ci/catalog.js` to confirm the JSON parses.
Example fix
// before (.claude-plugin/plugin.json — trailing comma)
{
"name": "ecc",
"version": "2.2.0",
"description": "...68 agents, 284 skills, 94 legacy command shims",
}
// after
{
"name": "ecc",
"version": "2.2.0",
"description": "...68 agents, 284 skills, 94 legacy command shims"
} Defensive patterns
Strategy: try-catch
Validate before calling
const fs = require('fs');
for (const p of ['.claude-plugin/plugin.json', '.claude-plugin/marketplace.json']) {
try {
JSON.parse(fs.readFileSync(p, 'utf8'));
} catch (e) {
console.error(`${p} is not valid JSON: ${e.message}`);
process.exit(1);
}
} Type guard
function isValidPluginJson(content) {
try { JSON.parse(content); return true; } catch { return false; }
} Try / catch
try {
runCatalogCheck();
} catch (error) {
if (/is not valid JSON/i.test(error.message)) {
console.error('Plugin manifest JSON is malformed. Run: node -e "JSON.parse(require(\'fs\').readFileSync(process.argv[1],\'utf8\'))" <file>');
}
throw error;
} Prevention
- Never hand-edit JSON with a text editor that strips quotes or allows comments — use a JSON-aware editor.
- Add `jsonlint` or a JSON schema check to pre-commit.
- Resolve merge conflicts in JSON files fully (remove conflict markers) before committing.
- Avoid trailing commas and unquoted keys.
When it happens
Trigger: Triggered when running the catalog check and either `.claude-plugin/plugin.json` or `.claude-plugin/marketplace.json` contains a JSON syntax error: trailing comma, unquoted key, single-quoted string, unescaped control char, BOM, or a hand-edit that broke the structure.
Common situations: A maintainer hand-edits plugin.json to bump a field and leaves a trailing comma or comment. A merge conflict marker is left inside the JSON. marketplace.json's plugins array is restructured. An editor inserts a BOM. The file is saved with CRLF and a stray character.
Related errors
- ${source} is missing the catalog count description
- README.md project tree is missing the agents count
- ${pattern.source} is missing the ${pattern.category} row
- README.zh-CN.md is missing the quick-start catalog summary
- docs/zh-CN/README.md is missing the quick-start catalog summ
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/3c6cfe82b4df3c70.
Report an issue: GitHub.