windmill-labs/windmill · error

error writing file to {path}: {e:#}

Error message

error writing file to {path}: {e:#}

What it means

test_s3_bucket verifies an S3-compatible storage configuration by writing a small object ('hello') to the given path with the object_store client, then reading it back. If the put fails, the error is wrapped as 'error writing file to {path}: {e:#}' so the underlying object-store error (auth, bucket missing, network) is preserved.

Source

Thrown at backend/windmill-api-settings/src/lib.rs:341

                    "Failed to list files in blob storage: {e:#}"
                )));
            }
            Some(Ok(first_file)) => tracing::info!("Listed files: {:?}", first_file),
            None => tracing::info!("No files in blob storage"),
        }

        let path = windmill_object_store::object_store_reexports::Path::from(format!(
            "/test-s3-bucket-{uuid}",
            uuid = uuid::Uuid::new_v4()
        ));
        tracing::info!("Testing blob storage at path: {path}");
        client
            .put(
                &path,
                windmill_object_store::object_store_reexports::PutPayload::from_static(b"hello"),
            )
            .await
            .map_err(|e| anyhow::anyhow!("error writing file to {path}: {e:#}"))?;
        let content = client
            .get(&path)
            .await
            .map_err(to_anyhow)?
            .bytes()
            .await
            .map_err(to_anyhow)?;
        if content != Bytes::from_static(b"hello") {
            return Err(error::Error::internal_err(
                "Failed to read back from blob storage".to_string(),
            ));
        }
        client.delete(&path).await.map_err(to_anyhow)?;
        Ok::<String, error::Error>("Tested blob storage successfully".to_string())
    };

    if restrict {
        // The object-store client is built with timeouts disabled, so a malicious endpoint could

View on GitHub (pinned to e474e8803c)

Solutions

  1. Verify the S3 resource settings (bucket, endpoint, region, access key, secret) in workspace or instance settings
  2. Test credentials with the AWS CLI: aws s3 cp test.txt s3://<bucket>/ to isolate permissions
  3. Check IAM/bucket policy grants s3:PutObject (and GetObject) to the used principal
  4. Confirm endpoint URL scheme (http/https) and reachability/network egress to the S3 endpoint

Example fix

// before (wrong endpoint)
endpoint: https://s3.amazonaws.com (bucket is on MinIO)
// after
endpoint: http://minio.internal:9000
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight checks before calling test_s3_bucket
assert!(!bucket.is_empty(), "bucket must be set");
assert!(endpoint.starts_with("http"), "endpoint must be a URL");
// verify credentials/permissions out-of-band:
// aws s3api head-bucket --bucket <bucket>

Try / catch

match test_s3_bucket(client, path).await {
    Ok(_) => info!("S3 storage OK"),
    Err(e) if e.to_string().contains("error writing file") => {
        error!("S3 put failed: {e:#}"); // inspect inner object-store cause
        show_storage_config_help(&e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Testing an S3 storage resource/connection in workspace settings where the put operation fails: wrong access/secret key, nonexistent bucket, wrong endpoint/region, missing s3:PutObject permission, or unreachable S3 endpoint.

Common situations: Misconfigured S3 resource (bad endpoint URL, region mismatch, typo'd bucket name), IAM policy lacking PutObject, MinIO/CEPH endpoint using http vs https incorrectly, expired credentials.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/725b47fedb637713. Report an issue: GitHub.