janhq/jan · error
settings:general.couldNotRelocateToRoot
settings:general.couldNotRelocateToRoot
Error message
settings:general.couldNotRelocateToRoot
What it means
During data folder relocation, confirmDataFolderChange blocks moving the data directory to a filesystem root (e.g. C:\, D:\, /). It throws an i18n-keyed error because relocating an app's data into the root would scatter/mix files at the filesystem root.
Solutions
- Choose a non-root subdirectory as the new data folder (e.g. D:\JanData or /home/user/jan)
- Create a dedicated folder before relocating
- Update the UI validation to pre-filter root directories in the picker
Example fix
// before
if (isRootDir(selectedNewPath))
throw new Error(t('settings:general.couldNotRelocateToRoot'))
// after
const target = selectedNewPath.replace(/[\\/]+$/, '')
if (isRootDir(target))
throw new Error(t('settings:general.couldNotRelocateToRoot'))
await serviceHub.app().relocateJanDataFolder(target) Defensive patterns
Strategy: validation
Validate before calling
if (isRootDir(selectedNewPath)) { showError(t('settings:general.couldNotRelocateToRoot')); return } Type guard
function isSafeTarget(p: string): boolean { return !!p && !isRootDir(p) } Try / catch
try { await confirmDataFolderChange() } catch (e) { dialog.showError(t('settings:general.couldNotRelocateToRoot')) } Prevention
- Disable root directories in the folder picker UI
- Normalize trailing separators before root checks
- Confirm dialog copy explains why root paths are rejected
When it happens
Trigger: User picks a drive root or '/' as the new Jan data folder in Settings > General and confirms the change.
Common situations: User selects a whole drive letter in the folder picker on Windows, or navigates to '/' on Unix, then confirms relocation.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Backend installed but failed to refresh UI
- Critical settings "llamacpp_version" / "llamacpp_backend"…
- Current backend not found
- Failed to decompress archive
- Failed to normalize backend layout
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/9372560fad13762e.
Report an issue: GitHub.
Appendix: source
Thrown at web-app/src/routes/settings/general.tsx:128
})
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 7205d770c1)