Skip to content

--command >256 chars fails launch: stored in EC2 tag (256-char cap); use user-data or fail fast client-side #246

Closed

Description

@scttfrdmn

Summary

spawn launch --command "<cmd>" fails at RunInstances when the command string exceeds 256
characters
, because spawn stores it verbatim in an EC2 tag (spawn:command) and EC2 caps tag
values at 256 chars:

Error: failed to launch instance: InvalidParameterValue: RunInstances ...
  api error InvalidParameterValue: Tag value exceeds the maximum length of 256 characters

Reproduction

spawn launch x --instance-type g5.4xlarge --region us-west-2 \
  --command "aws s3 cp s3://b/scripts/run.sh /tmp/run.sh --region us-west-2 && FLEET_OFFSET=0 FLEET_SIZE=4 GPU_COUNT=1 BUCKAI_BUCKET=b AWS_DEFAULT_REGION=us-west-2 SAM_CKPT_EVERY=25 SAM_CKPT_S3_PREFIX=s3://b/out/ nohup bash /tmp/run.sh > /tmp/run.log 2>&1 &"

(command here is 317 chars → hard fail; nothing launches)

Why it bites

Any non-trivial bootstrap command — fetch-a-script-and-run-it with a handful of env vars (a very
common pattern, and the one spawn's own docs encourage) — easily exceeds 256 chars. The failure
is a hard RunInstances error, not a warning, so the launch is lost.

Suggested fixes

  • Don't put the full command in a 256-char-capped EC2 tag. Options: pass it via user-data
    (where the spored bootstrap already lives — effectively unlimited), or store it in SSM Parameter
    Store / a spawn-managed S3 object and put only a short reference in the tag, or chunk it across
    tags and reassemble.
  • At minimum, validate length client-side and fail fast with an actionable message
    ("--command is N chars; EC2 tag limit is 256; pass a script reference instead") rather than a
    raw AWS tag error after IAM/SG setup.

Workaround

Keep --command short (just fetch+run a script); push all parameters into the script itself
(read from instance tags, an S3 config object, or bake per-instance values into the fetched
script). That's what we're doing for the fleet launch.

Context

Hit launching a fan-out fleet of g5.4xlarge for SAM inference (BuckAI/fieldwork): each instance's
command set its fleet shard offset + checkpoint config via env, which pushed past 256 chars.

Version

spawn v0.63.1

Activity

  1. added
    bug
    on Jun 25, 2026
  2. added a commit that references this issue on Jun 25, 2026
  3. scttfrdmn commented on Jun 25, 2026

    @scttfrdmn
    ContributorAuthor

    Fixed in #250 (v0.68.0): --command embedded in user-data (bootstrap prefers it over the tag); oversized command no longer written to the tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions