windmill-labs/windmill · error
rawscript is required for `rawscript` kind
Error message
rawscript is required for `rawscript` kind
What it means
The batch job-creation handler for kind "rawscript" requires the `rawscript` object (content, lock, etc.). If the batch item declares kind "rawscript" but the `rawscript` field is missing, this error is thrown. Pure input-validation guard.
Source
Thrown at backend/windmill-api/src/jobs.rs:9073
}
}
"rawscript" => {
if let Some(rawscript) = batch_info.rawscript {
(
None,
None,
JobKind::Preview,
rawscript.language,
None,
Default::default(),
None,
Some(rawscript.content),
rawscript.lock,
None,
None,
)
} else {
Err(anyhow::anyhow!(
"rawscript is required for `rawscript` kind"
))?
}
}
"flow" => {
let (mut value, job_kind, path) = if let Some(value) = batch_info.flow_value {
(value, JobKind::FlowPreview, None)
} else if let Some(path) = batch_info.path {
let mut tx = user_db.clone().begin(&authed).await?;
let value_json = sqlx::query!(
"SELECT coalesce(flow_version_lite.value, flow_version.value) as \"value!: sqlx::types::Json<Box<RawValue>>\" FROM flow
LEFT JOIN flow_version
ON flow_version.id = flow.versions[array_upper(flow.versions, 1)]
LEFT JOIN flow_version_lite
ON flow_version_lite.id = flow_version.id
WHERE flow.path = $1 AND flow.workspace_id = $2 LIMIT 1",
&path, &w_id
)View on GitHub (pinned to e474e8803c)
Solutions
- Include the `rawscript` object (with at least `content` and `lock`) in the batch item.
- If you meant to reference an existing script, switch the kind to "script" with a `path`.
- Validate your generated payload: every item with kind "rawscript" must carry a non-null `rawscript` field.
- If it comes from a flow export tool, re-export the flow and check the step still has content.
Example fix
// before
{ "kind": "rawscript" }
// after
{ "kind": "rawscript", "rawscript": { "content": "print('hi')", "language": "python3", "lock": [] } } Defensive patterns
Strategy: validation
Validate before calling
if (item.kind === 'rawscript' && !item.rawscript?.content) throw new Error(`batch item ${i}: rawscript.content required for kind=rawscript`); Type guard
function isRawscriptItem(item) { return item.kind === 'rawscript' && !!item.rawscript && typeof item.rawscript.content === 'string'; } Try / catch
try {
await batchCreate(items);
} catch (e) {
if (String(e).includes('rawscript is required')) console.error('rawscript payload missing on item', e);
else throw e;
} Prevention
- Embed full rawscript objects (content + lock) when kind is rawscript
- Use kind=script with a path if you only have a reference
- Round-trip test exported flows before importing
When it happens
Trigger: POSTing a batch item with kind "rawscript" but `batch_info.rawscript == None` — i.e. the request omits the `rawscript` object — at jobs.rs around line 9073.
Common situations: Flows-as-code import/export tools emitting a rawscript step without its payload; hand-written batch payloads copying a "script" item but only changing the kind; serialization bugs dropping the field.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Path is required if no value is not provided
- Completed jobs file must contain an array of jobs
- Unresolved inline script reference(s): ${refs}. A rawscript
- Invalid group at index ${index}: start_id must be a non-empt
- Invalid group at index ${index}: end_id must be a non-empty
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/4d6b372e941c4e70.
Report an issue: GitHub.