You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
task run: a spec over EC2's 16 KiB user-data limit passes --dry-run, then RunInstances fails with 400 #1063
A TaskSpec whose command is a long inline script launches fine in --dry-run and then fails at RunInstances with HTTP 400, before any instance exists. The cause is EC2's 16,384-byte user-data limit: spawn task run builds the wrapper (pkg/taskprotoGenerateWrapper, cmd/task.go:549) with the command embedded, and that wrapper becomes the instance's user data (cmd/task.go:577, taskLaunchConfig, comment at :991-992, "wrapper-as-user-data"). Nothing on the dry-run path (cmd/task.go:269) measures the encoded size, so a spec that cannot launch validates cleanly.
Measured: a scientific-codes-cookbook recipe (Signac) with an R script inlined in command: ["bash", "-c", ...] returned 400 from RunInstances on both arm64 (m8g) and x86_64 (m8i), at no cost. Moving the script into a staged, sha256-pinned input made the same spec launch and pass on both.
Suggested:
Compute the final encoded user data (after gzip and base64, exactly as it will be sent) in --dry-run and in ParseSpec/validation, and fail with a clear message when it is over 16,384 bytes, e.g. "the generated wrapper is N bytes after encoding; EC2 allows 16,384. Move long scripts into inputs: (staged files) instead of command."
Print the encoded size in the dry-run plan, as launch --dry-run already does with CustomUserDataBytes (cmd/launch_dryrun.go:81).
It's the same class as the pre-0.103.0 ParseSpec gap: a spec that parses but cannot act. The limit is fixed and known, so it can be checked before launch.
More evidence, and it is now a regression: specs that launched on earlier spawn versions are rejected on 0.130.1.
recipes/petsc (arm64) was last verified on spawn 0.123.0. On 0.130.1, RunInstances refuses it: InvalidParameterValue: User data is limited to 16384 bytes. The spec is unchanged.
gzip -9 sizes of the resolved TaskSpec, measured: 4,423 B launched; 4,961 B (petsc arm64), 5,448 B (petsc x86) and 6,345 B (seurat x86) were refused. So the ceiling sits near ~4.7–5 KB of gzipped spec, because the wrapper wraps the command and the bootstrap around it, and all of that rides in user data (pkg/launcher/bootstrap.go:42, :219; cmd/task.gotaskLaunchConfig, JobArrayCommand: wrapper).
By size, several more existing recipes are probably over the line now, without being launched to find out.
Two asks, in addition to the dry-run check above:
Carry the wrapper through S3 (user data fetches and verifies it) so the user-data payload stops growing with the spec and with each wrapper release.
Until then, a --dry-run that prints the encoded user-data size against the 16,384 B limit would have caught every one of these before launch.
Our mitigation for now is to stage long scripts as inputs: and keep command short.
Another way to hit the same limit: the input manifest, not the command. A TaskSpec with 267 per-file inputs entries (one per staged NIfTI) failed at launch with Encoded User data is limited to 25600 bytes; the command itself was short. The workaround was a single directory-prefix input. So the ceiling covers the whole serialized spec, which matters for any recipe that stages a cohort file-by-file. (scientific-codes-cookbook measurements/nilearn-real)
This has become a regression across versions, not just an edge case. It came from a backfill of 141 recipe smoke tests on AWS (scientific-codes-cookbook).
The specs didn't change between runs. On spawn 0.133.0 and 0.135.1, RunInstances refused 43 of 141 with User data is limited to 16384 bytes. Two (wgcna, mageck) failed instead with Encoded User data is limited to 25600 bytes.
The size split is clean. Every refused spec resolved to 5.8–15.5 KB of TaskSpec JSON. Every one that launched was ≤5.1 KB.
The cutoff sits between 0.128.2 and 0.131.1:
0.131.1 refuses them too. That's tested on relion, and an m8i (Intel) copy of the same spec is also refused, so it isn't family-specific.
0.128.2 launches all 43 unchanged. We used the official, checksum-verified v0.128.2 release as a workaround.
Suggestion: fetch the bootstrap from S3 (it's already staged per launch), or gzip the user data (cloud-init accepts gzip), so the fixed part shrinks back. Have --dry-run compute the final encoded size and fail at the 16 KiB / 25.6 KB limits. As things stand, every recipe whose spec carries a moderate inline script (a few KB) stops launching on current spawn.
Activity
scttfrdmn commentedon Oct 17, 2026
More evidence, and it is now a regression: specs that launched on earlier spawn versions are rejected on 0.130.1.
recipes/petsc(arm64) was last verified on spawn 0.123.0. On 0.130.1, RunInstances refuses it:InvalidParameterValue: User data is limited to 16384 bytes. The spec is unchanged.pkg/launcher/bootstrap.go:42,:219;cmd/task.gotaskLaunchConfig,JobArrayCommand: wrapper).Two asks, in addition to the dry-run check above:
--dry-runthat prints the encoded user-data size against the 16,384 B limit would have caught every one of these before launch.Our mitigation for now is to stage long scripts as
inputs:and keepcommandshort.scttfrdmn commentedon Oct 18, 2026
Another way to hit the same limit: the input manifest, not the command. A TaskSpec with 267 per-file
inputsentries (one per staged NIfTI) failed at launch withEncoded User data is limited to 25600 bytes; the command itself was short. The workaround was a single directory-prefix input. So the ceiling covers the whole serialized spec, which matters for any recipe that stages a cohort file-by-file. (scientific-codes-cookbookmeasurements/nilearn-real)scttfrdmn commentedon Oct 19, 2026
This has become a regression across versions, not just an edge case. It came from a backfill of 141 recipe smoke tests on AWS (scientific-codes-cookbook).
User data is limited to 16384 bytes. Two (wgcna, mageck) failed instead withEncoded User data is limited to 25600 bytes.m8i(Intel) copy of the same spec is also refused, so it isn't family-specific.git diff --stat v0.128.2 v0.131.1 -- pkg/launcher/bootstrap.go pkg/taskproto/ ':(exclude)*_test.go'shows bootstrap.go at +210/−33: the spored install (Install spored on spawn burst instances and pick an AMI that fits (#924) #940), plugins.json (Write plugins.json before spored starts (#1023) #1045) and others. That is roughly 4–5 KB more fixed user data on every launch. It pushes specs that fit under 0.128.2 over the 16 KiB limit, and those specs pass--dry-runcleanly.Suggestion: fetch the bootstrap from S3 (it's already staged per launch), or gzip the user data (cloud-init accepts gzip), so the fixed part shrinks back. Have
--dry-runcompute the final encoded size and fail at the 16 KiB / 25.6 KB limits. As things stand, every recipe whose spec carries a moderate inline script (a few KB) stops launching on current spawn.fix(task): refuse user data over EC2's 16 KiB limit before any AWS ca…