QuantumNous/new-api · warning · Error
We could not load instances.
Error message
We could not load instances.
What it means
Thrown by the useQuery queryFn in SystemInstancesPanel when listSystemInstances() rejects or returns success=false / a non-array data field. It is the panel's load failure path; because retry:false, the query lands in error state immediately and the panel renders its error UI with this message.
Source
Thrown at web/src/features/system-info/components/system-instances-panel.tsx:503
})}
</TableBody>
</Table>
</div>
)
}
export function SystemInstancesPanel() {
const { t } = useTranslation()
const queryClient = useQueryClient()
const [deleteTarget, setDeleteTarget] = useState<SystemInstance | null>(null)
const [deleteAllConfirmOpen, setDeleteAllConfirmOpen] = useState(false)
const [deletingNodeName, setDeletingNodeName] = useState<string | null>(null)
const instancesQuery = useQuery({
queryKey: ['system-info', 'instances'],
queryFn: async () => {
const res = await listSystemInstances()
if (!res.success || !Array.isArray(res.data)) {
throw new Error(res.message || t('We could not load instances.'))
}
return res.data
},
staleTime: 30 * 1000,
retry: false,
refetchInterval: INSTANCE_POLL_INTERVAL_MS,
})
const instances = instancesQuery.data ?? []
const staleInstances = instances.filter(
(instance) => instance.status === 'stale'
)
const hasStaleInstances = staleInstances.length > 0
const loading = instancesQuery.isLoading
const refreshing = instancesQuery.isFetching && !instancesQuery.isLoading
const invalidateInstances = async () => {
await queryClient.invalidateQueries({View on GitHub (pinned to e2c7aa7b10)
Solutions
- Check the HTTP status: 401/403 means the current user is not authorized for instance listing; sign in as an admin.
- Inspect response.message in the network tab for the backend's specific failure (e.g. Redis unreachable).
- Confirm the Go backend version actually exposes the instances endpoint used by listSystemInstances().
- If it is a transient network issue, the panel's refetchInterval polling will retry automatically; otherwise reload after fixing the backend.
Defensive patterns
Strategy: try-catch
Type guard
function isInstanceList(data: unknown): data is SystemInstance[] {
return Array.isArray(data) && data.every(
(i): i is SystemInstance =>
typeof i === 'object' && i !== null && typeof (i as SystemInstance).status === 'string'
)
} Try / catch
queryFn: async () => {
const res = await listSystemInstances()
if (!res.success || !Array.isArray(res.data)) {
throw new Error(res.message || t('We could not load instances.'))
}
return res.data
},
retry: false,
refetchInterval: INSTANCE_POLL_INTERVAL_MS, // auto-recovers from transient failures Prevention
- Gate the panel behind an admin permission check so unauthorized users never trigger the call.
- Keep retry:false but rely on refetchInterval polling for self-healing.
- Type-narrow res.data before use so contract drift fails loudly in dev, not silently in prod.
When it happens
Trigger: GET /api/system_instances (or equivalent) returns non-2xx or success=false: caller lacks admin rights, node stats middleware not enabled, or the endpoint errors while aggregating node heartbeats; also plain network failure or backend down.
Common situations: Non-admin user opens the system-info page; backend restarted and instance registry is empty; multi-node deployment where nodes have not phoned home; reverse proxy returning 502 while the Go service restarts.
Related errors
- Delete failed
- We could not load system tasks.
- Failed to sign out session
- Failed to sign out other sessions
- Failed to clean logs
AI-assisted analysis of QuantumNous/new-api@e2c7aa7b10 (2026-08-15).
Data as JSON: /api/errors/e0c7278c3548ee58.
Report an issue: GitHub.