hcengineering/platform · warning · Error
Already processing request
Error message
Already processing request
What it means
Connect.svelte wraps telegram command API calls (start/next code submission) in commandWithLoading, which guards a component-level `isLoading` flag. If a new command is issued while a previous one is still in flight, it throws 'Already processing request' to prevent interleaving telegram login steps (phone → code) out of order.
Source
Thrown at plugins/telegram-resources/src/components/Connect.svelte:47
export let reconnect: boolean = false
let phone: string = ''
let code: string = ''
let password: string = ''
let error: string = ''
let isLoading: boolean = false
const dispatch = createEventDispatcher()
function close (value?: string): void {
const connected = state.mode === 'Authorized' || state.mode === 'Configured'
dispatch('close', { value, connected })
}
// Wrapper for command API with loading state management
async function commandWithLoading (phone: string, action: 'start' | 'next', data?: string): Promise<IntegrationState> {
if (isLoading) {
throw new Error('Already processing request')
}
try {
isLoading = true
return await command(phone, action, data)
} finally {
isLoading = false
}
}
interface UIState {
mode: 'Loading' | 'WantPhone' | 'WantCode' | 'WantPassword' | 'Authorized' | 'Configured' | 'Unauthorized' | 'Error'
hint?: string
errorLabel?: IntlString
buttons?: {
primary?: { label: IntlString, handler?: () => any, disabled?: boolean }
secondary?: { label: IntlString, handler?: () => any }View on GitHub (pinned to 63e28dc964)
Solutions
- Disable the submit button and show a spinner while isLoading to prevent duplicate invocations.
- Debounce or deduplicate the command call in the click/submit handler.
- Add a timeout/abort for in-flight command() calls so isLoading cannot stay stuck on a hung request.
- Catch the error in the caller and surface a friendly 'please wait' message instead of a stack trace.
Example fix
// before
async function submit () {
await commandWithLoading(phone, 'next', code)
}
// after
async function submit () {
if (isLoading) return
try {
await commandWithLoading(phone, 'next', code)
} catch (e) {
if (e.message === 'Already processing request') return
throw e
}
} Defensive patterns
Strategy: validation
Validate before calling
if (isLoading) return // already in flight await commandWithLoading(phone, 'next', code)
Try / catch
try {
await commandWithLoading(phone, 'next', code)
} catch (e) {
if (e.message === 'Already processing request') {
showNotification('Please wait for the current step to finish')
} else throw e
} Prevention
- Disable submit buttons while isLoading
- Debounce click/submit handlers
- Add timeouts/aborts so isLoading cannot get stuck
When it happens
Trigger: Calling commandWithLoading(phone, 'start'|'next', data) while `isLoading` is true — e.g. double-clicking the confirm button or submitting the next auth step before the previous command resolves.
Common situations: Impatient user clicking the code-submit button twice on a slow telegram integration server; Enter key submitting twice; a hung previous request (network stall) keeping isLoading true indefinitely.
Related errors
- Error cleaning the package install folder (${packageInstallF
- Error cleaning the package install folder (${packageInstallF
- Accounts URL or token is not defined
- Not implemented
- attribute presenter not found for ${JSON.stringify(preserveK
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/f72df7df3d2b8b81.
Report an issue: GitHub.