{"record":{"id":"955aec82f69aad80","repo":"windmill-labs/windmill","slug":"e","errorCode":null,"errorMessage":"{e:#}","messagePattern":"\\{e:#\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/windmill-worker/src/duckdb_executor.rs","lineNumber":1241,"sourceCode":"        error: error.map(|e| e.to_string()),\n        schema: schema.clone(),\n    };\n    let res: anyhow::Result<()> = match conn {\n        Connection::Sql(db) => {\n            let partition_res = windmill_common::materialization::record_materialization(\n                db,\n                w_id,\n                req.asset_kind,\n                &req.asset_path,\n                &req.partition,\n                req.status,\n                req.snapshot_id,\n                req.row_count,\n                req.job_id,\n                req.error.as_deref(),\n            )\n            .await\n            .map_err(|e| anyhow::anyhow!(\"{e:#}\"));\n            // Schema capture is a separate, independently best-effort write (its\n            // own transaction for the per-asset advisory lock); a failure here\n            // must not lose the partition row above.\n            if let Some(cols) = schema.as_ref() {\n                if let Err(e) = record_asset_schema_best_effort(\n                    db,\n                    w_id,\n                    meta.asset_kind,\n                    &meta.asset_path,\n                    cols,\n                    snapshot_id,\n                    job_id,\n                )\n                .await\n                {\n                    tracing::warn!(\"failed to record captured asset schema: {e:#}\");\n                }\n            }","sourceCodeStart":1223,"sourceCodeEnd":1259,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/duckdb_executor.rs#L1223-L1259","documentation":"In Windmill's DuckDB materialization flow, `record_mat` persists the materialization outcome (partition row, status, row count) via `record_materialization`. This error is the `{e:#}` re-wrap of any failure from that best-effort write. The job itself is not failed by it, but the partition/materialization record is lost, degrading the asset grid view.","triggerScenarios":"Calling `record_materialization` (direct SQL path, `Connection::Sql`) when the insert/upsert into the materialization tables fails — DB unreachable, constraint violation on the (asset_kind, asset_path, partition) key, permission/schema issue, or serialization failure.","commonSituations":"Postgres restart or transient network drop mid-materialization; stale schema after a Windmill upgrade where migrations haven't run; duplicate partition rows racing a concurrent materialization of the same asset; agent worker posting to an API that returns 5xx.","solutions":["Check backend/worker logs for the underlying `{e:#}` chain root cause (usually a Postgres connection or constraint error).","Verify the Windmill database is reachable and migrations are up to date (`windmill_migration` table at latest revision).","Re-run the materialization job — the record write is best-effort and idempotent per partition, so a retry repopulates the grid row.","If it's a constraint/permission error, inspect the asset path and partition values for invalid characters or an asset that was deleted concurrently."],"exampleFix":"// before: failure silently lost in generic re-wrap\n.map_err(|e| anyhow::anyhow!(\"{e:#}\"))\n// after: log and still keep the run from failing, but with context\n.map_err(|e| {\n    log::warn!(\"record_materialization failed for {}/{}: {e:#}\", meta.asset_path, meta.partition);\n    anyhow::anyhow!(\"materialization record failed: {e:#}\")\n})","handlingStrategy":"try-catch","validationCode":"// check DB reachability before launching materializations\npsql \"$DATABASE_URL\" -c 'select 1' || echo 'DB down: materialization records will be lost'","typeGuard":null,"tryCatchPattern":"// best-effort: log, don't fail the job\nmatch record_materialization(...).await {\n    Ok(()) => {},\n    Err(e) => log::warn!(\"materialization record lost: {e:#}\"),\n}","preventionTips":["Keep the Windmill DB migrations current before running materialization jobs","Monitor Postgres availability from workers","Re-run failed materializations to repopulate missing partition rows"],"tags":["database","duckdb","materialization","best-effort"],"backgroundTag":"materialization-record-write-failed","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"}