libnyanpasu/clash-nyanpasu · error · Error
Failed to update
Error message
Failed to update
What it means
useBlockTask for core updates throws 'Failed to update' when updateCore.mutateAsync resolves to a falsy updaterId. A null/empty id means the backend did not register an updater task, so progress polling cannot proceed.
Source
Thrown at frontend/nyanpasu/src/pages/(main)/main/settings/clash/_modules/core-manager-card.tsx:50
SettingsCard,
SettingsCardContent,
SettingsCardFooter,
} from '../../_modules/settings-card'
function useCoreUpdateTask(
core?: ClashCore | null,
item?: ClashCoresDetail | null,
) {
const { query, updateCore, inspectUpdater } = useClashCores()
const [updater, setUpdater] = useState<UpdaterSummary>()
const task = useBlockTask(`core-manager-update-${core}`, async () => {
try {
const updaterId = await updateCore.mutateAsync(core!)
if (!updaterId) {
throw new Error('Failed to update')
}
await new Promise<void>((resolve, reject) => {
const interval = setInterval(async () => {
const result = await inspectUpdater(updaterId)
if (!result) {
reject(new Error('Failed to inspect updater'))
clearInterval(interval)
return
}
setUpdater(result)
if (
isObject(result.downloader.state) &&
Object.prototype.hasOwnProperty.call(
result.downloader.state,View on GitHub (pinned to f7dbce2997)
Solutions
- Check backend logs for why the updater returned no id
- Verify network connectivity to the core release source
- Confirm the core is not already at the latest version; retry the update
Defensive patterns
Strategy: try-catch
Validate before calling
const updaterId = await updateCore.mutateAsync(core)
if (!updaterId) {
// handle 'no update task' before polling
showToast('No update task started')
return
} Type guard
const hasUpdaterId = (v: unknown): v is string => typeof v === 'string' && v.length > 0
Try / catch
try {
await updateCoreTask(core)
} catch (e) {
if (e instanceof Error && e.message === 'Failed to update') {
showToast('Core update could not start; check backend logs')
}
} Prevention
- Check whether an update is actually needed before starting the task
- Verify the updater backend service is healthy
- Surface falsy updater ids immediately instead of polling
When it happens
Trigger: Calling the core update task from core-manager-card when the updateCore mutation succeeds but returns no updater id (backend refused or short-circuited the update, e.g. already on latest version or download could not start).
Common situations: Updating mihomo/clash core when the download service is unavailable, the version is already current, or the backend updater returned no task handle.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- result.error
- IPC server is already initialized
- application actor reply dropped
- session state actor reply dropped
- unsupported platform
AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08).
Data as JSON: /api/errors/980c106251e52fb2.
Report an issue: GitHub.