stablyai/orca · error · Error

Failed to load ${path.basename(jsonPath)}: ${error.message}

Error message

Failed to load ${path.basename(jsonPath)}: ${error.message}

What it means

locale-ko-key-overrides loads Korean key-specific translation overrides from a sibling JSON file (locale-ko-key-overrides.json). The raw JSON.parse is wrapped so that a parse failure names the offending file — a bare SyntaxError does not include the filename. The throw surfaces as a build/catalog-time failure importing the override catalog.

Source

Thrown at config/scripts/locale-ko-key-overrides.mjs:14

import fs from 'node:fs'
import path from 'node:path'

// Korean key-specific overrides (reviewed in full UI context: product names, git terms, and
// labels MT mistranslated). Stored as a JSON data file — too many entries to inline under the
// .mjs max-lines limit — and loaded here so the catalog scripts keep a single ko key-override source.
const jsonPath = path.join(import.meta.dirname, 'locale-ko-key-overrides.json')

let parsed
try {
  parsed = JSON.parse(fs.readFileSync(jsonPath, 'utf8'))
} catch (error) {
  // Name the file: a bare JSON.parse SyntaxError doesn't say which file failed.
  throw new Error(`Failed to load ${path.basename(jsonPath)}: ${error.message}`)
}

export const KO_KEY_OVERRIDES = parsed

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Open locale-ko-key-overrides.json in an editor/JSON linter and fix the syntax error the message reports.
  2. If the file is missing, restore it from git: git checkout HEAD -- config/scripts/locale-ko-key-overrides.json.
  3. Validate with a JSON parser (node -e "JSON.parse(require('fs').readFileSync('...'))") to confirm the fix before re-running the catalog.

Example fix

// before
try {
  parsed = JSON.parse(fs.readFileSync(jsonPath, 'utf8'))
} catch (error) {
  throw new Error(`Failed to load ${path.basename(jsonPath)}: ${error.message}`)
}

// after (caller)
// run once to locate the syntax error:
//   node -e "JSON.parse(require('fs').readFileSync('config/scripts/locale-ko-key-overrides.json','utf8'))"
// then fix the reported position in the JSON file.
Defensive patterns

Strategy: try-catch

Validate before calling

const txt = fs.readFileSync(jsonPath, 'utf8')
let parsed
try { parsed = JSON.parse(txt) } catch (e) {
  throw new Error(`${path.basename(jsonPath)} invalid at pos ${getPos(e)}: ${e.message}`)
}

Type guard

const isParsableJson = (txt) => { try { JSON.parse(txt); return true } catch { return false } }

Try / catch

try {
  import('./locale-ko-key-overrides.mjs')
} catch (e) {
  if (/Failed to load/.test(e.message)) { /* validate JSON, fix file, re-import */ }
  throw e
}

Prevention

When it happens

Trigger: The JSON file is missing (readFileSync throws ENOENT), or it contains a syntax error (trailing comma, unquoted key, stray character) so JSON.parse throws SyntaxError.

Common situations: Hand-editing the override JSON and leaving a syntax error, a merge conflict artifact in the file, the file not being committed/checked out in a shallow clone, or an encoding issue (BOM) from a Windows editor.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/c101e08352aca8e7. Report an issue: GitHub.