fix: VFS not initialized during Excel import, causing 0 files accessible

The VFSStructureGenerator.init() method tried to check if VFS was initialized
by calling stat('/'), which would throw if uninitialized. However, this
approach was unreliable. Changed to always call vfs.init() explicitly,
which is safe since vfs.init() is idempotent.

This fixes the critical bug where Excel imports completed successfully but
no VFS files were accessible afterwards. Users would see 'VFS not initialized'
errors when trying to query imported files.

Tested with 567-row Excel file - VFS now properly shows imported directory
structure with Characters/, Places/, Concepts/ subdirectories and metadata files.
This commit is contained in:
David Snelling 2025-10-29 19:13:04 -07:00
parent edf46155ef
commit 70d9460969

View file

@ -90,15 +90,10 @@ export class VFSStructureGenerator {
// Get brain's cached VFS instance (creates if doesn't exist) // Get brain's cached VFS instance (creates if doesn't exist)
this.vfs = this.brain.vfs() this.vfs = this.brain.vfs()
// Initialize if not already initialized // CRITICAL FIX (v4.10.2): Always call vfs.init() explicitly
// VFS.init() is idempotent (safe to call multiple times) // The previous code tried to check if initialized via stat('/') but this was unreliable
try { // vfs.init() is idempotent, so calling it multiple times is safe
// Check if already initialized await this.vfs.init()
await this.vfs.stat('/')
} catch (error) {
// Not initialized, initialize now
await this.vfs.init()
}
} }
/** /**