ruvnet/ruflo · error · Error
Import file not found: ${resolved}
Error message
Import file not found: ${resolved} What it means
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.
Source
Thrown at v3/@claude-flow/cli/src/services/config-file-manager.ts:154
const targetPath = this.configPath ?? path.resolve(cwd, CONFIG_FILENAMES[0]);
this.writeAtomic(targetPath, DEFAULT_CONFIG);
this.config = { ...DEFAULT_CONFIG };
this.configPath = targetPath;
return targetPath;
}
/** Export config to a specific path */
exportTo(cwd: string, exportPath: string): void {
const config = this.getConfig(cwd);
const resolved = path.resolve(cwd, exportPath);
this.writeAtomic(resolved, config);
}
/** Import config from a specific path */
importFrom(cwd: string, importPath: string): void {
const resolved = path.resolve(cwd, importPath);
if (!fs.existsSync(resolved)) {
throw new Error(`Import file not found: ${resolved}`);
}
const content = fs.readFileSync(resolved, 'utf-8');
let imported: Record<string, unknown>;
try {
imported = JSON.parse(content);
} catch {
throw new Error(`Invalid JSON in import file: ${resolved}`);
}
if (typeof imported !== 'object' || imported === null || Array.isArray(imported)) {
throw new Error('Import file must contain a JSON object');
}
const targetPath = this.configPath ?? path.resolve(cwd, CONFIG_FILENAMES[0]);
this.writeAtomic(targetPath, imported);
this.config = imported;
this.configPath = targetPath;
}
/** Get the path to the current config file */View on GitHub (pinned to 6b01dc5a68)
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.
Example fix
// before
manager.importFrom(cwd, './backup/config.json'); // may throw 'not found'
// after
const p = path.resolve(cwd, './backup/config.json');
if (!fs.existsSync(p)) throw new Error(`export first; expected ${p}`);
manager.importFrom(cwd, p); Defensive patterns
Strategy: validation
Validate before calling
const resolved = path.resolve(cwd, importPath);
if (!fs.existsSync(resolved)) {
throw new Error(`import source missing: ${resolved}`);
}
manager.importFrom(cwd, importPath); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Config file already exists: ${targetPath}. Use --force to ov
- trajectory envelope not found: ${path}
- browser/eval: script exceeds maximum length of ${MAX_EVAL_SC
- Invalid JSON in import file: ${resolved}
- Import file must contain a JSON object
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/307034ca956d17a9.
Report an issue: GitHub.