{"record":{"id":"307034ca956d17a9","repo":"ruvnet/ruflo","slug":"import-file-not-found-resolved","errorCode":null,"errorMessage":"Import file not found: ${resolved}","messagePattern":"Import file not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/config-file-manager.ts","lineNumber":154,"sourceCode":"    const targetPath = this.configPath ?? path.resolve(cwd, CONFIG_FILENAMES[0]);\n    this.writeAtomic(targetPath, DEFAULT_CONFIG);\n    this.config = { ...DEFAULT_CONFIG };\n    this.configPath = targetPath;\n    return targetPath;\n  }\n\n  /** 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 */","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/services/config-file-manager.ts#L136-L172","documentation":"ConfigFileManager.importFrom resolves importPath relative to cwd via path.resolve, then throws if the resolved path does not exist on disk. The import cannot proceed without a source file to read.","triggerScenarios":"Calling manager.importFrom(cwd, importPath) where importPath is wrong, is relative to a different cwd than expected, points to a file that was moved/deleted, or the path has a typo.","commonSituations":"Passing a relative path like '../config.json' when cwd is not what the caller assumed; export was written to a different directory than import reads from; path uses a leading '~' that path.resolve does not expand.","solutions":["Resolve and verify the path yourself first: const p = path.resolve(cwd, importPath); fs.existsSync(p).","Use an absolute path for importPath to remove cwd ambiguity.","Ensure exportTo wrote to the same resolved path you pass to importFrom.","Expand '~' to os.homedir() before passing home-relative paths."],"exampleFix":"// before\nmanager.importFrom(cwd, './backup/config.json'); // may throw 'not found'\n\n// after\nconst p = path.resolve(cwd, './backup/config.json');\nif (!fs.existsSync(p)) throw new Error(`export first; expected ${p}`);\nmanager.importFrom(cwd, p);","handlingStrategy":"validation","validationCode":"const resolved = path.resolve(cwd, importPath);\nif (!fs.existsSync(resolved)) {\n  throw new Error(`import source missing: ${resolved}`);\n}\nmanager.importFrom(cwd, importPath);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve import paths to absolute form before passing them.","Export and import using the same resolved path.","Expand '~' with os.homedir(); path.resolve does not.","Verify the file exists in CI logs before import steps."],"tags":["config","filesystem","typescript"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}