{"record":{"id":"2057aaa9b21aa222","repo":"ruvnet/ruflo","slug":"invalid-json-in-import-file-resolved","errorCode":null,"errorMessage":"Invalid JSON in import file: ${resolved}","messagePattern":"Invalid JSON in import file: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/config-file-manager.ts","lineNumber":161,"sourceCode":"  /** Export config to a specific path */\n  exportTo(cwd: string, exportPath: string): void {\n    const config = this.getConfig(cwd);\n    const resolved = path.resolve(cwd, exportPath);\n    this.writeAtomic(resolved, config);\n  }\n\n  /** Import config from a specific path */\n  importFrom(cwd: string, importPath: string): void {\n    const resolved = path.resolve(cwd, importPath);\n    if (!fs.existsSync(resolved)) {\n      throw new Error(`Import file not found: ${resolved}`);\n    }\n    const content = fs.readFileSync(resolved, 'utf-8');\n    let imported: Record<string, unknown>;\n    try {\n      imported = JSON.parse(content);\n    } catch {\n      throw new Error(`Invalid JSON in import file: ${resolved}`);\n    }\n    if (typeof imported !== 'object' || imported === null || Array.isArray(imported)) {\n      throw new Error('Import file must contain a JSON object');\n    }\n    const targetPath = this.configPath ?? path.resolve(cwd, CONFIG_FILENAMES[0]);\n    this.writeAtomic(targetPath, imported);\n    this.config = imported;\n    this.configPath = targetPath;\n  }\n\n  /** Get the path to the current config file */\n  getConfigPath(): string | null {\n    return this.configPath;\n  }\n\n  /** Get default config */\n  getDefaults(): Record<string, unknown> {\n    return { ...DEFAULT_CONFIG };","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/config-file-manager.ts#L143-L179","documentation":"importFrom() found the import file but JSON.parse threw on its contents, meaning the file is not valid JSON (truncated export, hand-edited file, wrong format). The catch converts the parse SyntaxError into this clearer error naming the offending resolved path before any config is applied.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/config-file-manager.ts:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the file with a JSON parser (e.g. jq) before importing","Fix the syntax error at the reported location"],"exampleFix":"Validate the file content with `jq . <file>` or `node -e 'JSON.parse(require(\"fs\").readFileSync(\"<file>\",\"utf8\"))'` and fix the JSON syntax error before re-importing.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}