janhq/jan · warning · Error
settings:general.couldNotRelocateToRoot
settings:general.couldNotRelocateToRoot
Error message
settings:general.couldNotRelocateToRoot
What it means
Thrown in confirmDataFolderChange (general.tsx:167) when the user-selected path for the Jan data folder is a filesystem root (isRootDir returns true). The guard prevents relocating app data into C:\, D:\, or /, which would scatter thousands of files across the root and break relative paths. Message is i18n key 'settings:general.couldNotRelocateToRoot'.
Source
Thrown at web-app/src/routes/settings/general.tsx:167
})
if (selectedPath === janDataFolder) return
if (selectedPath !== null) {
setSelectedNewPath(selectedPath as string)
setIsDialogOpen(true)
}
}
const confirmDataFolderChange = async () => {
if (selectedNewPath) {
try {
await serviceHub.models().stopAllModels()
serviceHub.events().emit(SystemEvent.KILL_SIDECAR)
setTimeout(async () => {
try {
// Prevent relocating to root directory (e.g., C:\ or D:\ on Windows, / on Unix)
if (isRootDir(selectedNewPath))
throw new Error(t('settings:general.couldNotRelocateToRoot'))
await serviceHub.app().relocateJanDataFolder(selectedNewPath)
setJanDataFolder(selectedNewPath)
// Only relaunch if relocation was successful
window.core?.api?.relaunch()
setSelectedNewPath(null)
setIsDialogOpen(false)
} catch (error) {
console.error(error)
toast.error(
error instanceof Error
? error.message
: t('settings:general.failedToRelocateDataFolder')
)
}
}, 1000)
} catch (error) {
console.error('Failed to relocate data folder:', error)
// Revert the data folder path on errorView on GitHub (pinned to fad3f12a14)
Solutions
- Select a named subfolder on the target drive, e.g. D:\JanData instead of D:\.
- The UI shows this as a toast; pick a non-root path and confirm again.
- If migrating to a new drive, create the target folder first in your file manager, then select it.
Example fix
// before
if (isRootDir(selectedNewPath))
throw new Error(t('settings:general.couldNotRelocateToRoot'))
// after: validate before showing the confirm dialog, disable the Confirm button
const isRoot = isRootDir(selectedNewPath)
// <Button disabled={isRoot}>{t('settings:general.confirm')}</Button>
{isRoot && <p className="text-warning">{t('settings:general.couldNotRelocateToRoot')}</p>} Defensive patterns
Strategy: validation
Validate before calling
function isSafeDataFolder(p: string): boolean {
return p.trim().length > 0 && !isRootDir(p)
}
// before confirmDataFolderChange runs:
if (!isSafeDataFolder(selectedNewPath)) {
// disable Confirm button, show inline warning
return
} Type guard
function isNonRootPath(p: unknown): p is string {
return typeof p === 'string' && p.trim().length > 0 && !isRootDir(p)
} Try / catch
try {
await serviceHub.app().relocateJanDataFolder(selectedNewPath)
} catch (e) {
// the root-dir guard throws before this; other relocation errors land here
toast.error(e instanceof Error ? e.message : t('settings:general.failedToRelocateDataFolder'))
} Prevention
- Validate the picked path before showing the confirm dialog.
- Disable the Confirm button when isRootDir is true so the user never hits the throw.
- Suggest a named subfolder when the user picks a drive root.
- Run isRootDir on every platform's picker result, not just Windows.
When it happens
Trigger: User opens the data-folder picker and selects a drive root (Windows C:\ or D:\, Unix /). isRootDir(selectedNewPath) returns true and the throw fires before relocateJanDataFolder runs.
Common situations: User wants the data on a different drive and picks the drive letter root instead of a named subfolder; accidental root selection in the native directory picker; user misunderstanding that any folder is acceptable but the root is not.
Related errors
- Critical settings "llamacpp_version" / "llamacpp_backend" no
- Failed to decompress archive: ${String(e)}
- Failed to normalize backend layout: ${String(e)}
- Backend installed but failed to refresh UI: ${String(e)}
- model.yml not found for ${modelId}
AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12).
Data as JSON: /api/errors/9372560fad13762e.
Report an issue: GitHub.