BloopAI/vibe-kanban · error · Error
Invalid response from file system API
Error message
Invalid response from file system API
What it means
In FolderPickerDialog's loadDirectory, the response of `fileSystemApi.list(path)` is validated before use: if it is null/undefined or not an object, the code throws 'Invalid response from file system API'. This indicates the file-system API endpoint returned something the dialog cannot interpret (empty body, error payload, or a non-JSON response) instead of a DirectoryListResponse.
Source
Thrown at packages/web-core/src/shared/dialogs/shared/FolderPickerDialog.tsx:72
}, [entries, searchTerm]);
useEffect(() => {
if (modal.visible) {
setManualPath(value);
loadDirectory();
}
}, [modal.visible, value]);
const loadDirectory = async (path?: string) => {
setLoading(true);
setError('');
try {
const result: DirectoryListResponse = await fileSystemApi.list(path);
// Ensure result exists and has the expected structure
if (!result || typeof result !== 'object') {
throw new Error('Invalid response from file system API');
}
// Safely access entries, ensuring it's an array
const entries = Array.isArray(result.entries) ? result.entries : [];
setEntries(entries);
const newPath = result.current_path || '';
setCurrentPath(newPath);
// Update manual path if we have a specific path (not for initial home directory load)
if (path) {
setManualPath(newPath);
}
} catch (err) {
setError(
err instanceof Error ? err.message : 'Failed to load directory'
);
// Reset entries to empty array on error
setEntries([]);
} finally {
setLoading(false);View on GitHub (pinned to 4deb7eca8f)
Solutions
- Check the network tab/backend logs for what the file-system list endpoint actually returned (status code, body).
- Ensure the API client throws on non-2xx responses instead of resolving with the error body.
- Verify the backend file-system service is running and reachable for the selected host.
- Confirm frontend/backend versions match so DirectoryListResponse serialization is compatible.
Example fix
// before
const result = await fileSystemApi.list(path);
// after
const res = await fetch(listUrl);
if (!res.ok) throw new Error(`File system API returned ${res.status}`);
const result = await res.json(); Defensive patterns
Strategy: type-guard
Validate before calling
const isDirectoryListResponse = (v: unknown): v is DirectoryListResponse => typeof v === 'object' && v !== null && Array.isArray((v as DirectoryListResponse).entries);
Type guard
function isDirectoryListResponse(v: unknown): v is DirectoryListResponse {
return (
typeof v === 'object' &&
v !== null &&
'entries' in v &&
Array.isArray((v as { entries: unknown }).entries)
);
} Try / catch
try {
await loadDirectory(path);
} catch (err) {
if (err instanceof Error && err.message === 'Invalid response from file system API') {
showEmptyState('Could not read directory');
}
} Prevention
- Make the API client throw on non-2xx HTTP statuses instead of resolving error bodies
- Validate response shape at the API-client boundary, not deep in components
- Monitor backend health of the file-system service for the active host
When it happens
Trigger: Calling fileSystemApi.list(path) where the backend responds with an empty body, an HTML error page, a null JSON literal, or any non-object payload that fails the `result && typeof result === 'object'` check.
Common situations: Backend proxy/auth failures returning error pages; a remote host where the file-system service is unreachable and the transport unwraps to null; version mismatch where an older/newer backend returns a differently-shaped payload; network middleware swallowing errors into undefined.
Related errors
- Host returned HTTP ${response.status}
- Auth methods lookup failed (${res.status})
- Failed to list projects (${res.status})
- Session refresh failed. Please sign in again.
- WebRTC offer failed: ${response.status} ${response.statusTex
AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29).
Data as JSON: /api/errors/8e704ca0506c43b0.
Report an issue: GitHub.