{"record":{"id":"a3797330cf989d9a","repo":"windmill-labs/windmill","slug":"invalid-text-file-resource-content-field-abs","errorCode":null,"errorMessage":"Invalid text file resource {}, `content` field absent or invalid","messagePattern":"Invalid text file resource (.+?), `content` field absent or invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/ansible_executor.rs","lineNumber":2325,"sourceCode":"    append_logs(job_id, w_id, logs, conn).await;\n\n    Ok(nsjail_mounts)\n}\n\nasync fn get_resource_or_variable_content(\n    client: &AuthedClient,\n    path: &ResourceOrVariablePath,\n    job_id: String,\n) -> anyhow::Result<String> {\n    Ok(match path {\n        ResourceOrVariablePath::Resource(p) => {\n            let r = client\n                .get_resource_value_interpolated::<serde_json::Value>(&p, Some(job_id))\n                .await?;\n\n            r.get(\"content\")\n                .and_then(|v| v.as_str())\n                .ok_or(anyhow!(\n                    \"Invalid text file resource {}, `content` field absent or invalid\",\n                    p\n                ))?\n                .to_string()\n        }\n        ResourceOrVariablePath::Variable(p) => client.get_variable_value(&p).await?,\n    })\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn no_job_envs() -> HashMap<String, String> {\n        HashMap::new()\n    }\n\n    fn args_from_json(v: serde_json::Value) -> HashMap<String, Box<RawValue>> {","sourceCodeStart":2307,"sourceCodeEnd":2343,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/ansible_executor.rs#L2307-L2343","documentation":"A 'text file' resource in Windmill must be a JSON object with a string 'content' field. When the resource at the given path is fetched, it either isn't an object or lacks a string 'content' member, so the worker cannot obtain the file body.","triggerScenarios":"The referenced resource (e.g. u/user/some_file) was created with a different shape (missing content key, content is a number/object, or the resource is arbitrary JSON), or the resource path points to the wrong type of object.","commonSituations":"Hand-edited resources missing 'content'; resources created for binary use ('content' base64 under a different key); typos pointing a text-file input at a plain credential resource.","solutions":["Edit the resource in the Windmill UI so it is a JSON object with a string field named 'content'","Verify the file resource's path in the job's file_resources configuration points to the intended resource","If the file is binary, use the appropriate (binary) file resource kind instead of a text file resource","Re-run the job after fixing the resource"],"exampleFix":"// before\n{ \"path\": \"/etc/config.txt\" }\n// after\n{ \"path\": \"/etc/config.txt\", \"content\": \"key=value\\n\" }","handlingStrategy":"validation","validationCode":"const res = await wmill.getResource(fileRes.resource_path);\nif (typeof res?.content !== 'string') {\n  throw new Error(`Resource ${fileRes.resource_path} needs a string 'content' field`);\n}","typeGuard":"function isTextFileResource(v: unknown): v is { content: string } {\n  return typeof v === 'object' && v !== null && typeof (v as any).content === 'string';\n}","tryCatchPattern":null,"preventionTips":["Create file resources via the UI's file-resource template","Don't repurpose plain objects as text file resources","Audit resources referenced by jobs after edits"],"tags":["resource","schema-validation","ansible"],"backgroundTag":"schema-validation-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"}