yikart/AiToEarn · error · Error
errors.restartFailed
Error message
errors.restartFailed
What it means
ConfigManagerDialog's restart handler throws this fallback Error when restartConfigEditorServiceApi returns a non-zero code or an empty response without a backend message. The catch block sets serviceStatus to 'failed', signaling the service could not be restarted from the dialog.
Source
Thrown at project/aitoearn-web/src/app/layout/ConfigManagerDialog/index.tsx:561
toast.success(t('messages.restartSuccess'))
return true
}
}
setServiceStatus('failed')
setError({ title: t('errors.healthTimeout'), description: t('errors.healthTimeoutDescription') })
return false
}, [serviceTarget, t])
const restartService = useCallback(async (action: LoadingAction = 'restart') => {
setLoadingAction(action)
setError(null)
setSuccessMessage('')
try {
const response = await restartConfigEditorServiceApi(serviceTarget, true)
if (!response || response.code !== 0) {
throw new Error(getResponseMessage(response) || t('errors.restartFailed'))
}
await waitForHealth()
}
catch (restartError) {
setServiceStatus('failed')
setError({ title: t('errors.restartFailed'), description: getErrorMessage(restartError) })
}
finally {
setLoadingAction(null)
}
}, [serviceTarget, t, waitForHealth])
const handleSaveAndRestart = useCallback(async () => {
const saved = await saveConfig('saveRestart')
if (!saved) {
setLoadingAction(null)
returnView on GitHub (pinned to d3aa8bea5b)
Solutions
- Check the target service host: process status, port conflicts, and supervisor/logs
- Verify health endpoint becomes responsive after restart (increase waitForHealth timeout if slow)
- Confirm the API caller has permission to trigger restarts for serviceTarget
- Retry restart; if it repeatedly fails, restart the service manually on the host
Example fix
// before
if (!response || response.code !== 0) {
throw new Error(getResponseMessage(response) || t('errors.restartFailed'))
}
// after
if (!response || response.code !== 0) {
setServiceStatus('failed')
setError(getResponseMessage(response) || t('errors.restartFailed'))
return
} Defensive patterns
Strategy: try-catch
Validate before calling
const health = await fetch(healthUrl); if (!health.ok) throw new Error('service unhealthy before restart') Try / catch
try {
const response = await restartConfigEditorServiceApi(serviceTarget, true)
if (!response || response.code !== 0)
throw new Error(getResponseMessage(response) || 'restart failed')
await waitForHealth()
} catch (e) {
setServiceStatus('failed')
setError(e instanceof Error ? e.message : 'restart failed')
} Prevention
- Set a generous waitForHealth timeout with polling rather than a single check
- Distinguish restart-call failure from health-check timeout in messages
- Check service process/port state on the host on repeated failures
- Disable the restart button while a restart is in flight
When it happens
Trigger: Calling restartConfigEditorServiceApi(serviceTarget, true) and receiving null/undefined response or response.code !== 0 with no message; also when the subsequent waitForHealth() throws.
Common situations: Relay/config-editor process cannot be restarted (port in use, crashed supervisor); health check never turns green after restart; service binary missing on host; insufficient permissions to restart.
Related errors
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/c587e623c0946f39.
Report an issue: GitHub.