quasarframework/quasar · error

Specified profile file has a syntax error

Error message

Specified profile file has a syntax error

What it means

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.

Source

Thrown at icongenie/lib/utils/get-profile-content.js:13

import { resolve } from 'node:path'
import { readFileSync } from 'node:fs'

import { warn } from './logger.js'
import { appDir } from './app-paths.js'

export function getProfileContent(profileFile) {
  const file = resolve(appDir, profileFile)

  try {
    return JSON.parse(readFileSync(file, 'utf8'))
  } catch (err) {
    warn(`Specified profile file has a syntax error`)
    console.error(err)
    process.exit(1)
  }
}

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Validate the file with `node -e "JSON.parse(require('fs').readFileSync('<file>','utf8'))"` — the thrown error pinpoints the syntax problem
  2. Fix the JSON: remove trailing commas, comments and single quotes; ensure double-quoted keys and values
  3. Verify the path passed to --profile is correct and the file exists (`ls <file>`)
  4. Save as plain UTF-8 JSON without BOM (disable JSONC/JSON5 editor features for this file)

Example fix

// before (profile.json)
{
  "quality": 90,
  "padding": "10%",  // trailing comma + comment
}
// after
{
  "quality": 90,
  "padding": "10%"
}
Defensive patterns

Strategy: validation

Validate before calling

const { readFileSync } = require('node:fs')
const { resolve } = require('node:path')
function assertValidProfile(profileFile) {
  const file = resolve(process.cwd(), profileFile)
  const raw = readFileSync(file, 'utf8').replace(/^\uFEFF/, '') // strip BOM
  JSON.parse(raw) // throws with position info if syntax is invalid
  return file
}
// run before: assertValidProfile('./my-profile.json')

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/1539654963107374. Report an issue: GitHub.