{"record":{"id":"1539654963107374","repo":"quasarframework/quasar","slug":"specified-profile-file-has-a-syntax-error","errorCode":null,"errorMessage":"Specified profile file has a syntax error","messagePattern":"Specified profile file has a syntax error","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"icongenie/lib/utils/get-profile-content.js","lineNumber":13,"sourceCode":"import { resolve } from 'node:path'\nimport { readFileSync } from 'node:fs'\n\nimport { warn } from './logger.js'\nimport { appDir } from './app-paths.js'\n\nexport function getProfileContent(profileFile) {\n  const file = resolve(appDir, profileFile)\n\n  try {\n    return JSON.parse(readFileSync(file, 'utf8'))\n  } catch (err) {\n    warn(`Specified profile file has a syntax error`)\n    console.error(err)\n    process.exit(1)\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/icongenie/lib/utils/get-profile-content.js#L1-L18","documentation":"icongenie profiles are JSON files describing icon-generation settings. getProfileContent readFileSync's the given profile path and JSON.parse's it; on any failure (unreadable/missing file or invalid JSON) it warns with this message, prints the underlying error, and exits 1. Despite the wording, the same catch also fires for a missing file since readFileSync is inside the try.","triggerScenarios":"Running `icongenie generate --profile <file>` (or profile subcommand) where the file path does not resolve under appDir, the file is unreadable, or its content is not valid JSON (trailing comma, comments, single quotes, truncated output).","commonSituations":"Hand-editing the profile and leaving a trailing comma or comment (JSON forbids both); wrong relative path to the profile; generating the profile from a template that was never filled in; file saved with a BOM or as JSON5/JSONC by an editor extension.","solutions":["Validate the file with `node -e \"JSON.parse(require('fs').readFileSync('<file>','utf8'))\"` — the thrown error pinpoints the syntax problem","Fix the JSON: remove trailing commas, comments and single quotes; ensure double-quoted keys and values","Verify the path passed to --profile is correct and the file exists (`ls <file>`)","Save as plain UTF-8 JSON without BOM (disable JSONC/JSON5 editor features for this file)"],"exampleFix":"// before (profile.json)\n{\n  \"quality\": 90,\n  \"padding\": \"10%\",  // trailing comma + comment\n}\n// after\n{\n  \"quality\": 90,\n  \"padding\": \"10%\"\n}","handlingStrategy":"validation","validationCode":"const { readFileSync } = require('node:fs')\nconst { resolve } = require('node:path')\nfunction assertValidProfile(profileFile) {\n  const file = resolve(process.cwd(), profileFile)\n  const raw = readFileSync(file, 'utf8').replace(/^\\uFEFF/, '') // strip BOM\n  JSON.parse(raw) // throws with position info if syntax is invalid\n  return file\n}\n// run before: assertValidProfile('./my-profile.json')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate profile JSON after every hand edit (JSON.parse in a scratch node command or a JSON linter)","Never use trailing commas or comments — icongenie expects strict JSON, not JSON5/JSONC","Save the profile as plain UTF-8 without BOM","Pass the profile path relative to the app dir and confirm it exists before running generate"],"tags":["json","icongenie","profile","configuration"],"backgroundTag":"invalid-json-file","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}