fix: Gracefully handle offline mode during backend check (#6767)

The `listSupportedBackends` function now includes error handling for the `fetchRemoteSupportedBackends` call.

This addresses an issue where an error thrown during the remote fetch (e.g., due to no network connection in offline mode) would prevent the subsequent loading of locally installed or manually provided llama.cpp backends.

The remote backend versions array will now default to empty if the fetch fails, allowing the rest of the backend initialization process to proceed as expected.
This commit is contained in:
Akarshan Biswas 2025-10-09 07:21:53 +05:30 committed by GitHub
parent 610b741db2
commit 01050f3103
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -156,8 +156,13 @@ export async function listSupportedBackends(): Promise<
supportedBackends.push('macos-arm64') supportedBackends.push('macos-arm64')
} }
// get latest backends from Github // get latest backends from Github
const remoteBackendVersions = let remoteBackendVersions = []
try {
remoteBackendVersions =
await fetchRemoteSupportedBackends(supportedBackends) await fetchRemoteSupportedBackends(supportedBackends)
} catch (e) {
console.debug(`Not able to get remote backends, Jan might be offline or network problem: ${String(e)}`)
}
// Get locally installed versions // Get locally installed versions
const localBackendVersions = await getLocalInstalledBackends() const localBackendVersions = await getLocalInstalledBackends()