danielmiessler/Fabric · info · Error
No file selected
Error message
No file selected
What it means
session-store.importFromFile throws 'No file selected' when the file-open dialog resolves without a file — the user cancelled the picker or it was dismissed. This is a control-flow signal more than a failure: nothing was imported and nothing is wrong.
Source
Thrown at web/src/lib/store/session-store.ts:78
sessions.set([]);
}
},
async exportToFile(messages: Message[]) {
try {
await saveToFile(messages, 'session-history.json');
toastService.success('Session exported successfully');
} catch (error) {
toastService.error('Failed to export session');
throw error;
}
},
async importFromFile(): Promise<Message[]> {
try {
const file = await openFileDialog('.json');
if (!file) {
throw new Error('No file selected');
}
const content = await readFileAsJson<Message[]>(file);
if (!Array.isArray(content)) {
throw new Error('Invalid session file format');
}
toastService.success('Session imported successfully');
return content;
} catch (error) {
toastService.error(error instanceof Error ? error.message : 'Failed to import session');
throw error;
}
},
async loadSessionMessages(sessionName: string): Promise<Message[]> {
try {
const response = await fetch(`/api/sessions/${sessionName}`);View on GitHub (pinned to 338b89cfe9)
Solutions
- Treat this as cancellation: catch it (or check the message) and return quietly instead of toasting an error
- Distinguish cancel from real failures by returning a sentinel from the dialog wrapper instead of throwing
Example fix
// before
const file = await openFileDialog('.json');
if (!file) {
throw new Error('No file selected');
}
// after
const file = await openFileDialog('.json');
if (!file) {
return []; // user cancelled; nothing to import
} Defensive patterns
Strategy: validation
Validate before calling
const file = await openFileDialog('.json');
if (!file) return []; // user cancelled — nothing to do Type guard
function isCancelError(e: unknown): boolean {
return e instanceof Error && e.message === 'No file selected';
} Try / catch
try { messages = await importFromFile(); }
catch (e) {
if (isCancelError(e)) return; // silent — cancellation is not an error
toast.error('Import failed');
} Prevention
- Treat a null dialog result as cancellation, not an exception
- Validate the parsed JSON is an array before using it (the store already does)
When it happens
Trigger: User clicks Cancel/Escape in the .json file picker; dialog closed without a selection; openFileDialog returning undefined/null on cancellation.
Common situations: Any import flow where cancellation is a normal path but the code treats a missing file as an error, showing an error toast for a simple cancel.
Related errors
AI-assisted analysis of danielmiessler/Fabric@338b89cfe9 (2026-08-15).
Data as JSON: /api/errors/e59a59b86645084c.
Report an issue: GitHub.