{"record":{"id":"16d78f3118cace5b","repo":"windmill-labs/windmill","slug":"worker-instance-and-version-are-required","errorCode":null,"errorMessage":"Worker instance and version are required","messagePattern":"Worker instance and version are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-common/src/worker.rs","lineNumber":1781,"sourceCode":"                insert_ping.tags.unwrap_or_default().as_slice(),\n                insert_ping.vcpus,\n                insert_ping.memory,\n                insert_ping.jobs_executed,\n                insert_ping.occupancy_rate,\n                insert_ping.memory_usage,\n                insert_ping.wm_memory_usage,\n                insert_ping.occupancy_rate_15s,\n                insert_ping.occupancy_rate_5m,\n                insert_ping.occupancy_rate_30m,\n                insert_ping.native_mode.unwrap_or(false),\n                insert_ping.ip.as_deref(),\n                db,\n            )\n            .await?\n        }\n        PingType::Initial => {\n            if insert_ping.worker_instance.is_none() || insert_ping.version.is_none() {\n                return Err(anyhow::anyhow!(\"Worker instance and version are required\"));\n            }\n\n            insert_ping_query(\n                &insert_ping.worker_instance.unwrap(),\n                &worker_name,\n                worker_group,\n                // An agent worker sends the sentinel rather than nothing, to stay acceptable to\n                // servers that still require an IP here; both mean \"not resolved yet\".\n                insert_ping.ip.as_deref().filter(|ip| *ip != UNKNOWN_IP),\n                insert_ping.tags.unwrap_or_default().as_slice(),\n                insert_ping.dw,\n                insert_ping.dws.as_deref(),\n                &insert_ping.version.unwrap(),\n                insert_ping.vcpus,\n                insert_ping.memory,\n                insert_ping.job_isolation,\n                insert_ping.native_mode.unwrap_or(false),\n                db,","sourceCodeStart":1763,"sourceCodeEnd":1799,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-common/src/worker.rs#L1763-L1799","documentation":"When a worker sends a PingType::Initial ping, the backend requires the ping payload to carry the worker_instance and version fields, because the initial ping is what registers the worker and its running version in the database. If either is missing, insert_ping_query cannot be called safely, so the API rejects the ping with this error.","triggerScenarios":"A worker (or a custom/third-party client mimicking one) POSTs a worker ping with type 'Initial' but leaves worker_instance or version null — typically a hand-crafted API call, an old worker binary, or a load-test script that builds the ping payload by hand.","commonSituations":"Running a worker version older than the server that predates the worker_instance/version fields; proxying the workers API through a custom tool that strips fields; automated monitoring scripts that ping the endpoint with incomplete payloads.","solutions":["Ensure the ping payload includes both worker_instance and version for PingType::Initial","Upgrade the worker binary to match the server version so it populates these fields automatically","If calling the API directly (e.g. in tests or scripts), set worker_instance to the worker's identifier and version to the worker's semantic version string"],"exampleFix":"// before\n{\"ping_type\": \"Initial\", \"worker_name\": \"w1\"}\n// after\n{\"ping_type\": \"Initial\", \"worker_name\": \"w1\", \"worker_instance\": \"w1@host-abc\", \"version\": \"v1.500.0\"}","handlingStrategy":"validation","validationCode":"if ping.ping_type == \"Initial\" && (ping.worker_instance.is_none() || ping.version.is_none()) {\n    return Err(\"Initial ping requires worker_instance and version\");\n}","typeGuard":"fn has_initial_fields(p: &Ping) -> bool {\n    p.ping_type != \"Initial\" || (p.worker_instance.is_some() && p.version.is_some())\n}","tryCatchPattern":"match client.send_ping(&ping).await {\n    Ok(_) => {},\n    Err(e) if e.to_string().contains(\"Worker instance and version are required\") => {\n        eprintln!(\"ping payload incomplete: populate worker_instance and version\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always populate worker_instance and version when constructing pings","Use the official worker binary instead of hand-built API calls","Add a payload schema check in any custom ping client"],"tags":["api","worker","validation"],"backgroundTag":"missing-required-argument","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"}