{"record":{"id":"77d1a68b31c1573c","repo":"windmill-labs/windmill","slug":"error-fetching-row","errorCode":null,"errorMessage":"Error fetching row: {:?}","messagePattern":"Error fetching row: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/mysql_executor.rs","lineNumber":106,"sourceCode":"                let mut conn = conn.lock().await;\n                let mut result = match conn.exec_iter(query, statement_values).await.map_err(to_anyhow) {\n                    Ok(result) => result,\n                    Err(e) => {\n                        yield Err(anyhow!(\"Error executing query: {:?}\", e));\n                        return;\n                    }\n                };\n                loop {\n                    let row = result.next().await;\n                    match row {\n                        Ok(Some(row)) => {\n                            yield Ok(convert_row_to_value(row));\n                        }\n                        Ok(None) => {\n                            break;\n                        }\n                        Err(e) => {\n                            yield Err(anyhow!(\"Error fetching row: {:?}\", e));\n                            return;\n                        }\n                    }\n                }\n            };\n\n            s3_stream_and_upload_with_logs(\n                \"MySQL\",\n                rows_stream.boxed(),\n                s3,\n                job_id,\n                workspace_id,\n                log_conn,\n            )\n            .await?;\n\n            Ok(vec![to_raw_value(&s3.to_return_s3_obj())])\n        } else {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/mysql_executor.rs#L88-L124","documentation":"In the MySQL executor's streaming loop, `result.next()` (row fetch) returned an error after iteration had already started, so the stream yields `Error fetching row` and stops. This differs from 1045: the query was accepted but the connection or result-set broke mid-stream.","triggerScenarios":"While pulling rows from a large result set, the connection drops, the server kills the query (max_execution_time, net_write_timeout), or the packet exceeds max_allowed_packet (very wide/long rows).","commonSituations":"Selecting millions of rows over a flaky network; MySQL proxy/LB with an idle timeout shorter than the fetch; `max_allowed_packet` too small for large BLOB/TEXT values; server-side query timeout killing the cursor mid-fetch.","solutions":["Inspect the wrapped error: 2020/1153 suggests max_allowed_packet; 1969/3024 suggests a server-side timeout; 2006/2013 a dropped connection.","Increase `max_allowed_packet` on the MySQL server if large rows are involved.","Reduce result size: add LIMIT/pagination or filter columns instead of SELECT *.","Raise `net_read_timeout`/`net_write_timeout` and LB idle timeouts for long fetches.","Retry the job — if transient network, a rerun often succeeds."],"exampleFix":"// before: fetching everything, breaks mid-stream\nSELECT * FROM huge_table;\n// after: batch the read\nSELECT * FROM huge_table ORDER BY id LIMIT 10000 OFFSET 0;","handlingStrategy":"retry","validationCode":"// pre-flight: estimate result size before streaming\n// SELECT COUNT(*) FROM huge_table WHERE ...;  — bail out or paginate if too large","typeGuard":null,"tryCatchPattern":"// wrap the streamed fetch with one retry on transient connection errors\nasync fn fetch_with_retry(q: &str) -> Result<Rows> {\n    match fetch(q).await {\n        Err(e) if is_transient(&e) => fetch(q).await,\n        other => other,\n    }\n}","preventionTips":["Paginate or LIMIT large reads instead of streaming entire tables","Raise max_allowed_packet if rows contain large BLOB/TEXT values","Set LB/proxy idle timeouts above the longest expected fetch","Avoid server-side max_execution_time shorter than your fetch duration"],"tags":["mysql","database","streaming","network"],"backgroundTag":"connection-dropped-mid-query","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}