windmill-labs/windmill · error
Test execution timed out after 60 seconds
Error message
Test execution timed out after 60 seconds
What it means
The copilot's test-run helper polls a script/flow test job and gives up after 60 seconds; on timeout it throws 'Test execution timed out after 60 seconds'. It also records a 'Test timed out' tool status with the message 'Execution timed out or failed to complete' so both user and model see the failure.
Source
Thrown at frontend/src/lib/components/copilot/chat/shared.ts:1603
status: deriveChatJobStatus(fetchedJob),
job: trimJob(fetchedJob)
})
} catch (error) {
if (!detachEnabled && attempts >= maxAttempts) {
throw error
}
}
}
if (!job) {
if (detachEnabled) {
return 'detached'
}
toolCallbacks.setToolStatus(toolId, {
content: 'Test timed out',
error: 'Execution timed out or failed to complete'
})
throw new Error('Test execution timed out after 60 seconds')
}
return job
}
// Helper function to extract code blocks from markdown text
export function extractCodeFromMarkdown(markdown: string): string[] {
const codeBlocks: string[] = []
// Matches: ```[language]\n[code]\n```
const codeBlockRegex = /```(?:[a-z]+)?\n([\s\S]*?)```/g
let match: RegExpExecArray | null = null
while ((match = codeBlockRegex.exec(markdown)) !== null) {
const code = match[1].trim()
if (code) {
codeBlocks.push(code)
}View on GitHub (pinned to e474e8803c)
Solutions
- Open the run in the Runs view to see whether it eventually finished or is stuck, and inspect the slow step.
- Shorten or optimize the tested code (add timeouts to external calls, remove sleeps) so it completes under 60s.
- Check that a worker is running and the queue is not backed up (jobs stuck in 'waiting').
- Re-run the test from the chat after fixing; if legitimately long-running, test the piece in isolation instead of the whole flow.
- If the job never started, check backend logs for scheduler/worker errors.
Example fix
// before (code under test hangs)
const data = await fetch('https://slow-api.example.com') // >60s
// after
const data = await fetchWithTimeout('https://slow-api.example.com', 10_000) Defensive patterns
Strategy: try-catch
Validate before calling
// sanity-check the code under test before running
if (/while\s*\(\s*true\s*\)/.test(code)) console.warn('possible infinite loop; test may hit the 60s timeout') Try / catch
try {
await runTest(job)
} catch (e) {
if (e.message === 'Test execution timed out after 60 seconds') {
// inspect run status out-of-band; do not blind-retry until the slow step is fixed
}
} Prevention
- Add explicit timeouts to external HTTP/DB calls inside tested scripts.
- Keep test payloads small; test heavy logic in isolation.
- Ensure workers are running and the queue is healthy before long test runs.
- Avoid sleeps and retry loops in code intended for quick test iterations.
When it happens
Trigger: A test run was queued successfully but the job had not reached a terminal state (success/failure) within the 60-second window — long-running script code, an infinite loop, a flow step waiting on a slow external API, a worker not picking up the job, or the poll loop's detached/abort branch being hit.
Common situations: Script calls a slow third-party API and exceeds 60s; flow contains a sleep or retry step; no worker available for the runtimes so the job stays queued; heavy queue backlog on a busy instance; debugging code with an accidental while(true).
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Failed to start test run - testFlow returned undefined
- No script code available to test. Please ensure you have a s
- Failed to execute test run: ${errorMessage}
- Timed out waiting for flow ${id} to complete
- Timed out waiting for job ${id}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/4c770fb5bf8a75ed.
Report an issue: GitHub.