{"record":{"id":"83c1963c5d929ed3","repo":"affaan-m/ECC","slug":"failed-to-parse-label-at-filepath-error-m-83c196","errorCode":null,"errorMessage":"Failed to parse ${label} at ${filePath}: ${error.message}","messagePattern":"Failed to parse (.+?) at (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/install-targets/cursor-project.js","lineNumber":28,"sourceCode":"  isForeignPlatformPath,\n} = require('./helpers');\n\nfunction toCursorRuleFileName(fileName, sourceRelativeFile) {\n  if (path.basename(sourceRelativeFile).toLowerCase() === 'readme.md') {\n    return null;\n  }\n\n  return fileName.endsWith('.md')\n    ? `${fileName.slice(0, -3)}.mdc`\n    : fileName;\n}\n\nfunction readJsonObject(filePath, label) {\n  let parsed;\n  try {\n    parsed = JSON.parse(fs.readFileSync(filePath, 'utf8'));\n  } catch (error) {\n    throw new Error(`Failed to parse ${label} at ${filePath}: ${error.message}`);\n  }\n\n  if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n    throw new Error(`Invalid ${label} at ${filePath}: expected a JSON object`);\n  }\n\n  return parsed;\n}\n\nfunction createJsonMergeOperation({ moduleId, repoRoot, sourceRelativePath, destinationPath }) {\n  const sourcePath = path.join(repoRoot, sourceRelativePath);\n  if (!fs.existsSync(sourcePath) || !fs.statSync(sourcePath).isFile()) {\n    return null;\n  }\n\n  return createManagedOperation({\n    kind: 'merge-json',\n    moduleId,","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/install-targets/cursor-project.js#L10-L46","documentation":"Thrown by readJsonObject() in the cursor-project adapter when reading a source file intended for a 'merge-json' operation. JSON.parse failed on the file at filePath. The label is typically the sourceRelativePath so the message identifies which module's source asset is broken.","triggerScenarios":"A module ships a source .json for merge into .cursor/ but the file is not valid JSON (trailing comma, unquoted keys, comments, BOM, truncation). The adapter only triggers this when createJsonMergeOperation chose that file.","commonSituations":"A source JSONC file (with comments) was used where strict JSON is required; an editor inserted a BOM; a copy was truncated mid-transfer; line-ending corruption.","solutions":["Open the file at filePath and run a JSON linter — fix trailing commas / comments / unquoted keys.","If the file should allow comments, pre-strip them before pointing the merge operation at it.","Remove the offending source asset from the module's manifest if it is not needed.","Re-clone the repo or git checkout HEAD -- on the broken file."],"exampleFix":"// before — source file contains a comment\n// settings.json\n{ \"foo\": 1 /* default */ }\n// after\n{ \"foo\": 1 }","handlingStrategy":"try-catch","validationCode":"let text;\ntry { text = fs.readFileSync(filePath, 'utf8'); }\ncatch (e) { throw new Error(`Cannot read ${filePath}: ${e.message}`); }\ntry { JSON.parse(text); } catch (e) {\n  throw new Error(`${filePath} is not valid JSON — fix or remove the merge source.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return readJsonObject(filePath, label);\n} catch (err) {\n  if (/^Failed to parse/.test(err.message)) {\n    // log and skip this merge operation\n    return null;\n  }\n  throw err;\n}","preventionTips":["Lint source JSON files in CI (e.g. jsonlint) so malformed merge sources never ship.","Do not put JSONC (comments) in files referenced by merge-json — strip comments first."],"tags":["install","cursor","json","io","merge"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}